Skip to content
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
Prev Previous commit
Next Next commit
fixup: make test work in workers
  • Loading branch information
apapirovski committed Jun 7, 2019
commit 20f2a93b55a83c8c5faf678732f395f060df2783
12 changes: 11 additions & 1 deletion test/async-hooks/test-late-hook-enable.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ const async_hooks = require('async_hooks');
// Checks that enabling async hooks in a callback actually
// triggers after & destroy as expected.

const fnsToTest = [setTimeout, setImmediate, (cb) => {
const fnsToTest = [setTimeout, (cb) => {
setImmediate(() => {
cb();

// We need to keep the event loop open for this to actually work
// since destroy hooks are triggered in unrefed Immediates
setImmediate(() => {
hook.disable();
});
})
}, (cb) => {
process.nextTick(() => {
cb();

Expand Down