mirror of
https://github.com/nodejs/node.git
synced 2024-11-25 08:19:38 +01:00
d10085bcb1
docs: add asyncWrapProviders api doc tests(async_hooks): use internalBinding for comparisson fix(test-async-wrap): lint error docs: use REPLACEME for asyncWrapProviders update: use freeze and copy for asyncWrapProviders update(async_hooks): use primordials on asyncWrapProviders fix: use common to expect error docs(asyncWrapProviders): rephrase return type fix: lint md fix: lint md docs(async_hooks): typo Co-authored-by: Stephen Belanger <admin@stephenbelanger.com> update(asyncWrapProviders): add __proto__ as null Co-authored-by: Simone Busoli <simone.busoli@gmail.com> Co-authored-by: Michaël Zasso <targos@protonmail.com> test: adjust __proto__ assertion docs: add DEP0111 link PR-URL: https://github.com/nodejs/node/pull/40760 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
19 lines
654 B
JavaScript
19 lines
654 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
const { internalBinding } = require('internal/test/binding');
|
|
const providers = internalBinding('async_wrap').Providers;
|
|
const assert = require('assert');
|
|
const { asyncWrapProviders } = require('async_hooks');
|
|
|
|
assert.ok(typeof asyncWrapProviders === 'object');
|
|
assert.deepStrictEqual(asyncWrapProviders, { __proto__: null, ...providers });
|
|
|
|
const providerKeys = Object.keys(asyncWrapProviders);
|
|
assert.throws(() => {
|
|
asyncWrapProviders[providerKeys[0]] = 'another value';
|
|
}, common.expectsError({
|
|
name: 'TypeError',
|
|
}), 'should not allow modify asyncWrap providers');
|