Using ember-cli 0.1.15 'ember test' giving error trying to use moment. The helper below loads fine in the browser, but the test fails trying to find moment.js:
Could not find module app/helpers/bower_components/moment/moment
App Helper
import Ember from 'ember';
import moment from './bower_components/moment/moment';
export function formattedDate(date, format) {
return moment(date).format(format);
}
export default Ember.Handlebars.makeBoundHelper(formattedDate);
Test
import {
formattedDate
} from '../../../helpers/formatted-date';
import { module, test } from 'qunit';
module('FormattedDateHelper');
test('Unit FormattedDate', function(assert) {
var Xmas95 = new Date('December 25, 1995 11:15:30');
var result = formattedDate(Xmas95,'MMMM Do, YYYY [at] h:mm a');
assert.ok(result === 'December 25th, 1995 at 11:15 am', 'boom: '.concat(result));
});
Brocfile.js
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp();
app.import('bower_components/moment/min/moment.min.js');
module.exports = app.toTree();
Full Error Message
not ok 21 PhantomJS 1.9 - TestLoader Failures: market/tests/unit/helpers/formatted-date-test: could not be loaded --- actual: > null message: > Died on test #1 at http://localhost:7357/assets/test-support.js:2535 at http://localhost:7357/assets/test-support.js:5297 at http://localhost:7357/assets/test-loader.js:31 at http://localhost:7357/assets/test-loader.js:21 at http://localhost:7357/assets/test-loader.js:40 at http://localhost:7357/assets/test-support.js:5301: Could not find module market/helpers/bower_components/moment/moment Log: > ...