我正在使用 gulp-jasmine-node
插件来运行我的Jasmine / Frisby.js测试,如下所示:
gulp.task('runJasmine', function() {
return gulp.src(['test/*spec.js'])
.pipe(jasmineNode({
timeout: 10000
}));
});
gulp.task('test', ['runJasmine']);
在本地运行 gulp test
我得到以下内容(仅限代码段):
2) Frisby Test: Get API root
[ GET http://localhost:8080/api ]
Message:
Error: Header 'content-type' not present in HTTP response
Stacktrace:
Error: Header 'content-type' not present in HTTP response
at null.<anonymous>
...
Finished in 0.042 seconds
1 test, 2 assertions, 2 failures, 0 skipped
我的.travis.yml:
language: node_js
node_js:
- "0.12"
- "4.2.4"
- "5.3.0"
before_script:
- npm install -g gulp
script: gulp test
Travis上的相应原始CI输出(仅限结束片段):
Finished in 0.054 seconds
[31m1 test, 2 assertions, 2 failures, 0 skipped
[0m travis_time:end:00bb9734:start=1455472901504935117,finish=1455472903105906383,duration=1600971266
[0K [32;1mThe command "gulp test" exited with 0.[0m
Done. Your build exited with 0.
我不确定为什么构建会在失败时传递 - 在使用gulp时Travis中是否有某种配置,具体取决于所使用的测试工具?是否由于进程退出代码0,如果是,我是否需要修改我的gulp命令以在失败时退出进程(不理想,因为它会中断运行器中的其他任务) .
似乎无法找到此问题或预先解决的相同设置 . 请帮忙!此外,这是我的第一个Stack Overflow Q,所以希望我提供了所需的所有信息 . 谢谢 :)
1 回答
这个答案与jasmin / frisby无关 . 但是仍然可能会帮助其他人在缺少测试并且让travis ci通过的情况下以0为目标 .
这是我的gulp测试
我想出的部分是你可以通过
process.exit(1);
手动退出gulp,退出代码为非0,然后travis将失败 .