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 — module: report unfinished TLA in ambiguous modules · nodejs/node@249d82b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/modules/cjs
    • loader.js
  • test
    • es-module
      • test-esm-detect-ambiguous.mjs
    • fixtures/es-modules/tla
      • unresolved.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/modules/cjs/loader.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/loader.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ function loadESMFromCJS(mod, filename) {
13361336
if (isMain) {
13371337
require('internal/modules/run_main').runEntryPointWithESMLoader((cascadedLoader) => {
13381338
const mainURL = pathToFileURL(filename).href;
1339-
cascadedLoader.import(mainURL, undefined, { __proto__: null }, true);
1339+
return cascadedLoader.import(mainURL, undefined, { __proto__: null }, true);
13401340
});
13411341
// ESM won't be accessible via process.mainModule.
13421342
setOwnProperty(process, 'mainModule', undefined);
Collapse file

‎test/es-module/test-esm-detect-ambiguous.mjs‎

Copy file name to clipboardExpand all lines: test/es-module/test-esm-detect-ambiguous.mjs
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,18 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL },
252252
strictEqual(signal, null);
253253
});
254254

255+
it('reports unfinished top-level `await`', async () => {
256+
const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [
257+
'--no-warnings',
258+
fixtures.path('es-modules/tla/unresolved.js'),
259+
]);
260+
261+
strictEqual(stderr, '');
262+
strictEqual(stdout, '');
263+
strictEqual(code, 13);
264+
strictEqual(signal, null);
265+
});
266+
255267
it('permits top-level `await` above import/export syntax', async () => {
256268
const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [
257269
'--eval',
Collapse file

‎test/fixtures/es-modules/tla/unresolved.js‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
await new Promise(() => {});

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.