即使单元测试失败,TravisCI 也不会失败
TravisCI not failing even though unit tests fail
我正在测试我的 GitHub 集成 Travis CI/Grunt 构建,即使我的测试失败,它似乎也没有失败。
您可以看到 here 我的两个作业 "jshint" 和 "qunit" 都失败了:
Warning: Task "jshint:files" failed. Used --force, continuing.
Warning: Task "qunit:files" failed. Used --force, continuing.
但是 Travis CI 构建仍然 "passed":
Done. Your build exited with 0.
在我的package.json
中我指定在scripts
到运行grunt qunit
:
"scripts": {
"test": "grunt qunit"
}
并且在我的 Gruntfile.js
中注册了一个 test
任务:
grunt.registerTask('test', ['jshint','qunit']);
当我的 linting 或单元测试失败时,如何让我的 Travis CI 构建失败?
我将从 your travis.yml
中删除 --force
开始
手册是这样说的:
--force, -f
A way to force your way past warnings. Want a suggestion? Don't use
this option, fix your code.
我正在测试我的 GitHub 集成 Travis CI/Grunt 构建,即使我的测试失败,它似乎也没有失败。
您可以看到 here 我的两个作业 "jshint" 和 "qunit" 都失败了:
Warning: Task "jshint:files" failed. Used --force, continuing.
Warning: Task "qunit:files" failed. Used --force, continuing.
但是 Travis CI 构建仍然 "passed":
Done. Your build exited with 0.
在我的package.json
中我指定在scripts
到运行grunt qunit
:
"scripts": {
"test": "grunt qunit"
}
并且在我的 Gruntfile.js
中注册了一个 test
任务:
grunt.registerTask('test', ['jshint','qunit']);
当我的 linting 或单元测试失败时,如何让我的 Travis CI 构建失败?
我将从 your travis.yml
--force
开始
手册是这样说的:
--force, -f
A way to force your way past warnings. Want a suggestion? Don't use this option, fix your code.