Skip to content

Commit 1befe3f

Browse files
dygaboeliphazbouye
authored andcommitted
lib: fix the name of the fetch global function
PR-URL: nodejs#53227 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
1 parent ec89e0c commit 1befe3f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/internal/bootstrap/web/exposed-window-or-worker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
7070
configurable: true,
7171
enumerable: true,
7272
writable: true,
73-
value: function value(input, init = undefined) {
73+
value: function fetch(input, init = undefined) { // eslint-disable-line func-name-matching
7474
if (!fetchImpl) { // Implement lazy loading of undici module for fetch function
7575
const undiciModule = require('internal/deps/undici/undici');
7676
fetchImpl = undiciModule.fetch;

test/parallel/test-global.js

+8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ for (const moduleName of builtinModules) {
6161
'navigator',
6262
];
6363
assert.deepStrictEqual(new Set(Object.keys(global)), new Set(expected));
64+
expected.forEach((value) => {
65+
const desc = Object.getOwnPropertyDescriptor(global, value);
66+
if (typeof desc.value === 'function') {
67+
assert.strictEqual(desc.value.name, value);
68+
} else if (typeof desc.get === 'function') {
69+
assert.strictEqual(desc.get.name, `get ${value}`);
70+
}
71+
});
6472
}
6573

6674
common.allowGlobals('bar', 'foo');

0 commit comments

Comments
 (0)