-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add two tests regarding crashes in context switching.
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
assert = require 'assert' | ||
fs = require 'fs' | ||
|
||
describe 'contexts', -> | ||
describe 'setTimeout in fs callback', -> | ||
it 'does not crash', (done) -> | ||
fs.readFile __filename, -> | ||
setTimeout done, 0 | ||
|
||
describe 'throw error in node context', -> | ||
it 'get caught', (done) -> | ||
error = new Error('boo!') | ||
lsts = process.listeners 'uncaughtException' | ||
process.removeAllListeners 'uncaughtException' | ||
process.on 'uncaughtException', (err) -> | ||
process.removeAllListeners 'uncaughtException' | ||
for lst in lsts | ||
process.on 'uncaughtException', lst | ||
done() | ||
fs.readFile __filename, -> | ||
throw error |