dimanche 1 mars 2015

ember-cli: ember test error global modules not found

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();




Aucun commentaire:

Enregistrer un commentaire