当我运行jasmine without grunt
时,测试运行得很好但是当使用grunt jasmine task
运行时,它会失败。
我认为这可能是因为grunt正在使用headless phantom js browser
运行规范。虽然命令行jasmine
只是在本地运行测试。
从CLI运行:jasmine
Started
.
1 spec, 0 failures
Finished in 0.005 seconds
使用Grunt-cli运行:grunt jasmine
Running "jasmine:test" (jasmine) task
Testing jasmine specs via PhantomJS
common JS Tests
X encountered a declaration exception
Error: Module name "src/common" has not been loaded yet for context: _. Use require([])
http://requirejs.org/docs/errors.html#notloaded in file:///home/surfer190/projects/MyProj/src/js/libs/require.js (line 8) (1)
1 spec in 0.006s.
>> 1 failures
Warning: Task "jasmine:test" failed. Use --force to continue.
Aborted due to warnings.
Gruntfile.js:
jasmine: {
test: {
options: {
specs: 'spec/**/*.spec.js',
vendor: [
'src/js/libs/require.js',
]
}
}
},
jasmine.json:
{
"spec_dir": "spec",
"spec_files": [
"**/*.[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
],
"stopSpecOnExpectationFailure": false,
"random": false
}