Skip to content
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

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions test/parallel/test-async-wrap-uncaughtexception.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ let hooks = null;
// under some conditions on variaous platforms. Using the once
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: various

// handler here avoids the flakiness but ignores the underlying
// cause of the flakiness.
process.once('beforeExit', common.mustCall(() => {
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]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the call_log logging, but why comment these out? They won't get executed twice now because of the process.exit(1) above.

Copy link
Member Author

Choose a reason for hiding this comment

The 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({
Expand Down