Skip to content

Commit 57d7bbf

Browse files
dygabomarco-ippolito
authored andcommitted
lib: fix the name of the fetch global function
PR-URL: #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 9d3699b commit 57d7bbf

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
@@ -64,7 +64,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
6464
configurable: true,
6565
enumerable: true,
6666
writable: true,
67-
value: function value(input, init = undefined) {
67+
value: function fetch(input, init = undefined) { // eslint-disable-line func-name-matching
6868
if (!fetchImpl) { // Implement lazy loading of undici module for fetch function
6969
const undiciModule = require('internal/deps/undici/undici');
7070
fetchImpl = undiciModule.fetch;

test/parallel/test-global.js

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

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

0 commit comments

Comments
 (0)