テストを実行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
}