GeezerVison is showing github.com — module: report unfinished TLA in ambiguous modules · nodejs/node@249d82b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/loader.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1336,7 +1336,7 @@ function loadESMFromCJS(mod, filename) { | 1336 | 1336 | if (isMain) { | 1337 | 1337 | require('internal/modules/run_main').runEntryPointWithESMLoader((cascadedLoader) => { | 1338 | 1338 | const mainURL = pathToFileURL(filename).href; | 1339 | | - cascadedLoader.import(mainURL, undefined, { __proto__: null }, true); | | 1339 | + return cascadedLoader.import(mainURL, undefined, { __proto__: null }, true); | 1340 | 1340 | }); | 1341 | 1341 | // ESM won't be accessible via process.mainModule. | 1342 | 1342 | setOwnProperty(process, 'mainModule', undefined); | |
Collapse file Copy file name to clipboardExpand all lines: test/es-module/test-esm-detect-ambiguous.mjs +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -252,6 +252,18 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL }, | 252 | 252 | strictEqual(signal, null); | 253 | 253 | }); | 254 | 254 |
| | 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 | + | 255 | 267 | it('permits top-level `await` above import/export syntax', async () => { | 256 | 268 | const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [ | 257 | 269 | '--eval', | |
Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +await new Promise(() => {}); |
|