diff options
Diffstat (limited to 'tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js')
-rw-r--r-- | tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js new file mode 100644 index 0000000000..054d1d857b --- /dev/null +++ b/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js @@ -0,0 +1,26 @@ +'use strict'; + +/** + * 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 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); +}); |