我有一个关于在Grunt上使用茉莉花的问题。我不断收到错误消息,
ReferenceError:找不到变量:在以下位置需要
每当我运行茉莉花测试时。这是我的Gruntfile.js的茉莉花条目:
jasmine: {
js: {
src: jsFiles,
options: {
specs: 'tests/*_spec.js',
helpers: 'tests/helpers/*',
vendor: 'vendor/*'
}
}
},
我可以在没有需求的情况下运行虚拟测试,但是像这样在测试中包含需求时,出现需求错误。
var testD = require('../src/events_to_actions');
describe("events_to_actions", function() {
it("is dummy test", function() {
expect(true).toEqual(true);
});
});
我有同样的问题。只需安装此节点软件包并将此行添加到您的Gruntfile中,require应该重新开始工作。
https://github.com/cloudchen/grunt-template-jasmine-requirejs
jasmine: {
js: {
src: jsFiles,
options: {
specs: 'tests/*_spec.js',
helpers: 'tests/helpers/*',
vendor: 'vendor/*',
template: require('grunt-template-jasmine-requirejs')
}
}
},
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句