mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
lib: fix the name of the fetch global function
PR-URL: https://github.com/nodejs/node/pull/53227 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
1 parent
7125931f4c
commit
667191119f
2 files changed
+9
-1
No files matched your search
@@ -70,7 +70,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: function value(input, init = undefined) {
|
||||
value: function fetch(input, init = undefined) { // eslint-disable-line func-name-matching
|
||||
if (!fetchImpl) { // Implement lazy loading of undici module for fetch function
|
||||
const undiciModule = require('internal/deps/undici/undici');
|
||||
fetchImpl = undiciModule.fetch;
|
||||
|
||||
@@ -61,6 +61,14 @@ for (const moduleName of builtinModules) {
|
||||
'navigator',
|
||||
];
|
||||
assert.deepStrictEqual(new Set(Object.keys(global)), new Set(expected));
|
||||
expected.forEach((value) => {
|
||||
const desc = Object.getOwnPropertyDescriptor(global, value);
|
||||
if (typeof desc.value === 'function') {
|
||||
assert.strictEqual(desc.value.name, value);
|
||||
} else if (typeof desc.get === 'function') {
|
||||
assert.strictEqual(desc.get.name, `get ${value}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
common.allowGlobals('bar', 'foo');
|
||||
|
||||
Reference in new issue
Block a user