Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

make uncaughtException test more stable (#4107)

Juerg B47dcc5f325e3
diff --git a/test/integration/fixtures/uncaught.fixture.js b/test/integration/fixtures/uncaught.fixture.js
index 6a2ded88..2ef81700 100644
--- a/test/integration/fixtures/uncaught.fixture.js
+++ b/test/integration/fixtures/uncaught.fixture.js
@@ -6,17 +6,17 @@
*/
it('fails exactly once when a global error is thrown first', function (done) {
- setTimeout(function () {
+ process.nextTick(function () {
throw new Error('global error');
- }, 0);
+ });
});
it('fails exactly once when a global error is thrown second', function (done) {
- setTimeout(function () {
+ process.nextTick(function () {
done(new Error('test error'));
- }, 0);
+ });
- setTimeout(function () {
+ process.nextTick(function () {
throw new Error('global error');
- }, 0);
+ });
});