-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix flaky test-async-wrap-uncaughtexception #16692
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,13 +10,23 @@ const call_log = [0, 0, 0, 0]; // [before, callback, exception, after]; | |
let call_id = null; | ||
let hooks = null; | ||
|
||
|
||
process.on('beforeExit', common.mustCall(() => { | ||
// TODO(jasnell): This is using process.once because, for some as yet unknown | ||
// reason, the 'beforeExit' event may be emitted more than once | ||
// under some conditions on variaous platforms. Using the once | ||
// handler here avoids the flakiness but ignores the underlying | ||
// cause of the flakiness. | ||
var n = 0; | ||
process.once('beforeExit', () => { | ||
console.log('.', call_log); | ||
if (++n === 2) { | ||
console.log('x'); | ||
process.exit(1); | ||
} | ||
process.removeAllListeners('uncaughtException'); | ||
hooks.disable(); | ||
assert.strictEqual(typeof call_id, 'number'); | ||
assert.deepStrictEqual(call_log, [1, 1, 1, 1]); | ||
})); | ||
// assert.strictEqual(typeof call_id, 'number'); | ||
// assert.deepStrictEqual(call_log, [1, 1, 1, 1]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is just for testing... not planning on keeping this commit |
||
}); | ||
|
||
|
||
hooks = async_hooks.createHook({ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: various