admin管理员组文章数量:1332383
I have written a simple node.js application and now I want to add some tests. For now I have only some example Tests to test my Gitlab-CI, SonarQube and Mocha, which i am using for testing.
Now my problem is, that I want to parse the results from mocha (reporter is the sonar-mocha-reporter). My problem is that mocha exits the process with status 1 if a test is failing. That means gitlab-ci is breaking the build and will not run to the end. So i can not parse the results like it should.
Is there a way to configure mocha to not break my build so that it only saves the results in this xml file?
I am starting mocha with:
./node_modules/.bin/mocha -R mocha-sonar-reporter --recursive --no-exit
and in my package.json i have the configuration:
"config": {
"mocha-sonar-reporter": {
"outputfile": "build/reports/tests/TEST-mocha.xml"
}
},
I have written a simple node.js application and now I want to add some tests. For now I have only some example Tests to test my Gitlab-CI, SonarQube and Mocha, which i am using for testing.
Now my problem is, that I want to parse the results from mocha (reporter is the sonar-mocha-reporter). My problem is that mocha exits the process with status 1 if a test is failing. That means gitlab-ci is breaking the build and will not run to the end. So i can not parse the results like it should.
Is there a way to configure mocha to not break my build so that it only saves the results in this xml file?
I am starting mocha with:
./node_modules/.bin/mocha -R mocha-sonar-reporter --recursive --no-exit
and in my package.json i have the configuration:
"config": {
"mocha-sonar-reporter": {
"outputfile": "build/reports/tests/TEST-mocha.xml"
}
},
Share
Improve this question
edited Apr 19, 2016 at 14:23
Jessica Weber
asked Apr 19, 2016 at 14:07
Jessica WeberJessica Weber
1322 silver badges11 bronze badges
2 Answers
Reset to default 8Perhaps can you just do:
./node_modules/.bin/mocha || true
If it fails, it will then return true
, and be successful.
Add parameter silent
to mand line. For example:
npm run test --silent
本文标签: javascripthow to prevent mocha from exiting process with status 1Stack Overflow
版权声明:本文标题:javascript - how to prevent mocha from exiting process with status 1 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742288578a2447375.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论