GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — esm: handle `globalPreload` hook returning a nullish value · nodejs/node@655111f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/modules/esm
    • hooks.js
  • test/es-module
    • test-esm-loader-hooks.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/modules/esm/hooks.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/esm/hooks.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Hooks {
168168
port: insideLoader,
169169
});
170170

171-
if (preloaded == null) { return; }
171+
if (preloaded == null) { continue; }
172172

173173
if (typeof preloaded !== 'string') { // [2]
174174
throw new ERR_INVALID_RETURN_VALUE(
Collapse file

‎test/es-module/test-esm-loader-hooks.mjs‎

Copy file name to clipboardExpand all lines: test/es-module/test-esm-loader-hooks.mjs
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,20 @@ describe('Loader hooks', { concurrency: true }, () => {
348348
});
349349
});
350350

351+
it('should handle globalPreload returning undefined', async () => {
352+
const { code, signal, stdout, stderr } = await spawnPromisified(execPath, [
353+
'--no-warnings',
354+
'--experimental-loader',
355+
'data:text/javascript,export function globalPreload(){}',
356+
fixtures.path('empty.js'),
357+
]);
358+
359+
assert.strictEqual(stderr, '');
360+
assert.strictEqual(stdout, '');
361+
assert.strictEqual(code, 0);
362+
assert.strictEqual(signal, null);
363+
});
364+
351365
it('should be fine to call `process.removeAllListeners("beforeExit")` from the main thread', async () => {
352366
const { code, signal, stdout, stderr } = await spawnPromisified(execPath, [
353367
'--no-warnings',

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.