Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: fix the name of the fetch global function #53227

Merged
merged 2 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/bootstrap/web/exposed-window-or-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions test/parallel/test-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down