mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
Correct the implementaton of enabledHooksExist to return true if there are enabled hooks. Adapt callsites which used getHooksArrays() as workaround. PR-URL: https://github.com/nodejs/node/pull/61054 Fixes: https://github.com/nodejs/node/issues/61019 Refs: https://github.com/nodejs/node/pull/59873 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
19 lines
459 B
JavaScript
19 lines
459 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { createHook } = require('async_hooks');
|
|
const { enabledHooksExist } = require('internal/async_hooks');
|
|
|
|
assert.strictEqual(enabledHooksExist(), false);
|
|
|
|
const ah = createHook({});
|
|
assert.strictEqual(enabledHooksExist(), false);
|
|
|
|
ah.enable();
|
|
assert.strictEqual(enabledHooksExist(), true);
|
|
|
|
ah.disable();
|
|
assert.strictEqual(enabledHooksExist(), false);
|