-
-
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
fix improper warnings for invalid reporters #4275
Conversation
65b5a7d
to
1ba7cc6
Compare
I should note that I started out adding more coverage and refactoring, but I found a bug while I was doing that... |
Odd the logic been broken for so long for such an important check. Would have been good to see an issue or details in the description to help replicate locally. Would this logic apply all the time or just programmatic use of mocha only? ( |
can't use |
1ba7cc6
to
89cb1e7
Compare
OK, we can't use rewiremock in cc @Munter -- how's the transpilation coming? 😄 |
tests broke because you can't use |
263c7b1
to
0929e14
Compare
@nicojs I had heavily refactored |
@boneskull You're not kidding, file looks like a Christmas tree in my browser 🎄. Will checkout this branch locally to take a better look. Will have to wait till tomorrow. |
0929e14
to
f210e64
Compare
your changes highlight that It accepts an optional callback, and that callback is called with a single parameter, It would likely be highly disruptive to break this, unfortunately. Off the top of my head, two ways we could improve the situation:
Consumers of |
f210e64
to
cf53102
Compare
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.
Looks good to me! Some minor suggestions.
}); | ||
|
||
describe('when the reporter throws upon load', function() { | ||
it('should throw "invalid reporter" exception', function() { |
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.
Love the fact that this is split out from the should warn ...
test 😍. Also for the mocha unit tests.
also: reorganize, add, and refactor a bunch of problematic unit tests for `lib/mocha.js`. better isolation except where we can't really do that (calling `require`) there's still missing tests in here, but this is an improvement.
cf53102
to
4f01095
Compare
- better isolation - a use of `process.cwd()` in `lib/runner.js` was left in place to avoid conflicts, because another PR will remove it
* fix improper warnings for invalid reporters also: reorganize, add, and refactor a bunch of problematic unit tests for `lib/mocha.js`. better isolation except where we can't really do that (calling `require`) there's still missing tests in here, but this is an improvement. * restrict use of Object.assign in ESLint config * add wrapper around process.cwd() - better isolation - a use of `process.cwd()` in `lib/runner.js` was left in place to avoid conflicts, because another PR will remove it
also: reorganize, add, and refactor a bunch of problematic unit tests for
lib/mocha.js
. better isolation except where we can't really do that (callingrequire
)there's still missing tests in here, but this is an improvement.
@craigtaub this touches some stuff regarding warnings for invalid reporters. it looks like the conditionals were backwards?