-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore async global errors after spec resolution
- Loading branch information
1 parent
4067c06
commit 210803c
Showing
3 changed files
with
19 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
'use strict'; | ||
|
||
/** | ||
* This file should only generate one test error despite the fact that Mocha is | ||
* capable of detecting two distinct exceptions during test execution. | ||
* This file should only generate one failure per spec despite the fact that | ||
* Mocha is capable of detecting two distinct exceptions during test execution. | ||
*/ | ||
|
||
it('fails exactly once', function(done) { | ||
it('fails exactly once when a global error is thrown first', function(done) { | ||
setTimeout(function() { | ||
throw new Error('global error'); | ||
|
||
setTimeout(function() { | ||
done(new Error('test error')); | ||
}, 0); | ||
}, 0); | ||
}); | ||
|
||
it('fails exactly once when a global error is thrown second', function(done) { | ||
setTimeout(function() { | ||
done(new Error('test error')); | ||
}, 0); | ||
|
||
setTimeout(function() { | ||
throw new Error('global error'); | ||
}, 0); | ||
}); |