| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fc90d7c commit 1d16976
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1370,7 +1370,7 @@ function loadESMFromCJS(mod, filename) { | |||
| 1370 | 1370 | if (isMain) { | |
| 1371 | 1371 | require('internal/modules/run_main').runEntryPointWithESMLoader((cascadedLoader) => { | |
| 1372 | 1372 | const mainURL = pathToFileURL(filename).href; | |
| 1373 | - cascadedLoader.import(mainURL, undefined, { __proto__: null }, true); | ||
| 1373 | + return cascadedLoader.import(mainURL, undefined, { __proto__: null }, true); | ||
| 1374 | 1374 | }); | |
| 1375 | 1375 | // ESM won't be accessible via process.mainModule. | |
| 1376 | 1376 | setOwnProperty(process, 'mainModule', undefined); | |
| 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', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + await new Promise(() => {}); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments