feat: add option to not fail on failing test suite#4771
feat: add option to not fail on failing test suite#4771JoshuaKGoldberg merged 6 commits intomochajs:mainfrom
Conversation
|
This PR hasn't had any recent activity, and I'm labeling it |
|
Ping |
|
This PR hasn't had any recent activity, and I'm labeling it |
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
Looking good as a start! The logical flow makes sense and seems reasonable to me. 🔥
Requesting changes mostly on docs/naming and testing. A bit of code shuffling too, but I'm open to getting told I'm being overly nitpicky. 😄
|
👋 ping @ilgonmic, is this still something you have time for? |
|
Hi @JoshuaKGoldberg |
5c1be0d to
964fa2c
Compare
|
@JoshuaKGoldberg Hi, I tried to fix all concers, could you please take a look? |
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
🙌 This looks great, thanks so much @ilgonmic!
I'll merge and release this in a new minor version soon. 🚀
| return code => { | ||
| const clampedCode = passOnFailingTestSuite | ||
| ? 0 | ||
| : Math.min(code, 255); |
There was a problem hiding this comment.
[Praise] I like the moving of the Math.min(code, 255) here, nice spot!
|
Published in |
* Add option fail-on-failing-test-suite to not fail test run if there were no infrastructure problem * Add test on failOnFailingTestSuite * Use parameters which by default is false * Update docs/index.md * refactor: shared clampedCode --------- Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
Requirements
Description of the Change
Fixed #4216
Add possibility to distinguish 2 types of fails:
When there are problems with test run, it is definitely problem.
When tests were run, but there are some test fails, it can be considered as ok.
It is useful to use Mocha in integrations with different build tools (for example Gradle), when we extract information from Mocha about tests and pass it to build tool and check exit code of Mocha.
Karma has similar feature
Alternate Designs
It can be done with 2 runs of Mocha:
dry-runand check if JavaScript code can be run without problemsBut it requires 2 runs, which is not very convenient.
Why should this be in core?
When using Mocha and look at exit code, it is impossible to distinguish 2 cases
But these 2 cases can be completely different
Benefits
New useful feature for build pipelines integrations
Possible Drawbacks
Applicable issues
#4216