-
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes a problem where expected EventEmitter-related throws are impossible to test, because the domain hijacks the 'error' event. Of course, this means that asynchronous unexpected throws will always be assigned to the global root TAP object, but... what can you do? If people complain, we can try to figure out something clever using continuation-local-storage or something. Ugh. Domains. The not-quite-worst-possible solution to any problem, which always ends up regrettably. I am, as always, truly and deeply sorry for inflicting this feature on Node.js
- Loading branch information
Showing
7 changed files
with
47 additions
and
46 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// make sure domains don't obscure things. | ||
var tap = require('..') | ||
var EE = require('events').EventEmitter | ||
|
||
function testFunction (t) { | ||
var ee = new EE | ||
|
||
t.throws(function () { | ||
ee.emit('error', new Error('one')) | ||
}, new Error('one')) | ||
|
||
try { | ||
ee.emit('error', new Error('two')) | ||
t.fail('should throw') | ||
} catch (er) { | ||
t.match(er, { message: 'two' }, 'threw expected error') | ||
} | ||
t.end() | ||
} | ||
|
||
tap.test('child', testFunction) | ||
testFunction(tap) |
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
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