-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3363: Throw error if unable to parse Mocha options file #3376
Conversation
Code now throws an error for any problems (except nonexistent default "test/mocha.opts"). Fixes mochajs#3363
BTW, anyone run across this ChromeHeadless problem before? Same code ran file for all test jobs except this last one. Restarting made no difference. MochaJS PR run afterwards was fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@plroebuck You didn't set saucelab in your travisci, see |
Added information on file content, noting support for comment/blank lines.
This reverts commit d6a5c10.
@outsideris, add "server-major" tag, pls! |
@boneskull ping |
will review some stuff tomorrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this change semver major?
@Bamieh I think this is a breaking change because users will get the errors when there is no opts file. Before this change, users don't care about the existence of the opts file. |
@outsideris makes sense, but looking at the code, it will only throw if there is an error in the existing file. if it does not exist, no errors will be throws. So i have a feeling that this is more of a bug fix rather than a breaking change.
Do you think there are people running mocha with a broken opt file? I believe its not that case because mocha would not be running as they expect anyways. |
Not exactly, @outsideris... It's a breaking change because an Error could now occur where it does not in the current version. Even though the existing code is broken (due to masking), I consider it major since it might disrupt the CI process by causing run failures. Mocha would now throw when user-specified |
| Do you think there are people running mocha with a broken opt file? I believe its not that case Point being that they may not even know it's broken yet... "confirmed-bug" label was correct. |
If so, it seems semver-minor, not semver-major like what @Bamieh said. |
it's server-major if upgrading can break something. |
This would be a bug if Mocha had intended to throw an error upon an invalid opts file, but failed to do so correctly. Since Mocha's current behavior is intended (which is to say, doing nothing) this isn't a bug fix. But it is a breaking change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be possible to write an integration test for this. You can create a dummy invalid mocha.opts
file somewhere under test/integration/fixtures/
and use the runMocha
helper with args --opts /path/to/bad/mocha.opts
, and assert the output contains an error.
This will also appease Coveralls.
Added tests for `--opts` as none previously existed. Added "do nothing" fixture test. Minor change to helper routine so that it used `path.join()` properly.
Had problems getting this branch updated post-UnexpectedJS. Opening new PR instead. |
Description of the Change
Code now throws an error for any problems loading the Mocha options file (except for nonexistent default "test/mocha.opts").
Builds off of previous discussions and work done in PR #2716 and PR #3352 .
Why should this be in core?
Silently ignoring problems loading this file is just wrong.
Benefits
Users will now be told if the file failed to load.
Possible Drawbacks
Users with invalid Mocha options files (or permissions problems, etc.) will need to correct the problem.
Applicable issues
Fixes #3363
Fixes #2576
(server-major) [since Mocha could throw an error when it didn't previously]