Skip to content

Commit 98ae1eb

Browse files
dygabotargos
authored andcommitted
lib: fix the name of the fetch global function
PR-URL: #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>
1 parent d4f5f80 commit 98ae1eb

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
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: functionvalue(input,init=undefined){
67+
value: functionfetch(input,init=undefined){// eslint-disable-line func-name-matching
6868
if(!fetchImpl){// Implement lazy loading of undici module for fetch function
6969
constundiciModule=require('internal/deps/undici/undici');
7070
fetchImpl=undiciModule.fetch;

‎test/parallel/test-global.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ for (const moduleName of builtinModules) {
6161
'navigator',
6262
];
6363
assert.deepStrictEqual(newSet(Object.keys(global)),newSet(expected));
64+
expected.forEach((value)=>{
65+
constdesc=Object.getOwnPropertyDescriptor(global,value);
66+
if(typeofdesc.value==='function'){
67+
assert.strictEqual(desc.value.name,value);
68+
}elseif(typeofdesc.get==='function'){
69+
assert.strictEqual(desc.get.name,`get ${value}`);
70+
}
71+
});
6472
}
6573

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

0 commit comments

Comments
 (0)