0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/async-hooks/test-enable-in-init.js
Mitch Hankins 848ae89d79 test: refactor test-enable-in-init
Remove unused function arguments. Convert to ES6 arrow syntax.

PR-URL: https://github.com/nodejs/node/pull/24976
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-12-13 17:28:55 -08:00

23 lines
473 B
JavaScript

'use strict';
const common = require('../common');
const async_hooks = require('async_hooks');
const fs = require('fs');
const nestedHook = async_hooks.createHook({
init: common.mustNotCall()
});
let nestedCall = false;
async_hooks.createHook({
init: common.mustCall(() => {
nestedHook.enable();
if (!nestedCall) {
nestedCall = true;
fs.access(__filename, common.mustCall());
}
}, 2)
}).enable();
fs.access(__filename, common.mustCall());