mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
b27e2408af
Convert all anonymous callback functions in `test/async-hooks/*.js` to use arrow functions. `writing-tests.md` states to use arrow functions when appropriate. PR-URL: https://github.com/nodejs/node/pull/30137 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
24 lines
482 B
JavaScript
24 lines
482 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const async_hooks = require('async_hooks');
|
|
const fs = require('fs');
|
|
|
|
let nestedCall = false;
|
|
|
|
async_hooks.createHook({
|
|
init: common.mustCall(() => {
|
|
nestedHook.disable();
|
|
if (!nestedCall) {
|
|
nestedCall = true;
|
|
fs.access(__filename, common.mustCall());
|
|
}
|
|
}, 2)
|
|
}).enable();
|
|
|
|
const nestedHook = async_hooks.createHook({
|
|
init: common.mustCall(2)
|
|
}).enable();
|
|
|
|
fs.access(__filename, common.mustCall());
|