-
-
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
uncaughtException after runner's end: improve exit code #4019
Conversation
@medikoo I would highly appreciate your feedback to this draft PR, thank you! |
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.
Great thanks @juergba for initiative. Having that fixed in Mocha will be really helpfiul.
Concerning #3917 I commented (it fixes issue but only for Node.js v10+, not sure if it's intended)
Concerning #3938 it fixes issue but only when--allowUncaught
is set. If I see the complete fix would be to do console.error('\n', err); process.exit(1);
also when runnable.isFailed() || runnable.isPending()
is met here:
Line 830 in 6ec07d6
return; |
TBH I don't really want to touch this recovery feature when For your needs is there anything opposing against using |
8dbfb73
to
5b63b8e
Compare
I have to investigate further about the dependencies of |
The more I'm testing this, the more weird behavior pops up. describe('test', () => {
it('test1', function() { });
it('test2', function () {
this.skip();
});
it('test3', function () { });
it('test4', function () {
this.skip();
});
}); Running with
There is no (uncaught) exception, but all |
@medikoo above bug ( Node's docu states:
Do you have some time left to comment this? |
In my understanding, it's just to indicate that we cannot be sure of side effects/broken states that come with uncaught exceptions, and therefore we should not try to recover from them. Otherwise if we know what we're doing (e.g. recovering from plain Still, I totally I agree, that designing Maybe it'll be good with a new major, to narrow async support just to promises, and that way errors handling could be simplified (?) When sync tests and async tests resolved via promises are concerned, I believe that any With how current implemention works, I would definitely not ignore uncaught exceptions that follows ones thrown via |
@medikoo thank you.
it('test', function (done) {
var self = this;
setTimeout(function () {
instruction1;
self.skip(); // includes implicit 'done()' and throws a 'Pending' error
instruction2; // does not run
instruction3; // does not run
}, 100);
}); The idea was to abort an asyncly running callback and not to execute The user could easily get the same result by using |
I think fact that But in async tests reported via |
5b63b8e
to
f6780d7
Compare
f6780d7
to
9743cb5
Compare
9743cb5
to
f90c624
Compare
f90c624
to
d45a389
Compare
d45a389
to
e24b4b1
Compare
e24b4b1
to
e540f84
Compare
e540f84
to
147f763
Compare
@medikoo thank you for your support! |
Description
This PR forked various PR's concerning uncaught exceptions:
Description of the Change
Applicable issues
closes #3917