Skip to content

Commit

Permalink
test repair
Browse files Browse the repository at this point in the history
  • Loading branch information
mert authored and mert committed Dec 10, 2024
1 parent b76fdb4 commit c3a13fb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/es-module/test-esm-detect-ambiguous.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL },
// https://github.com/nodejs/node/issues/50917
describe('syntax that errors in CommonJS but works in ESM', { concurrency: !process.env.TEST_PARALLEL }, () => {
it('permits top-level `await`', async () => {
const { stdout, stderr, code } = await spawnPromisified(process.execPath, [
const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [
'--eval',
'await Promise.resolve();',
'await Promise.resolve(); console.log("executed");',
]);

match(
Expand All @@ -252,6 +252,7 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL },
);
strictEqual(stdout, '');
strictEqual(code, 1);
strictEqual(signal, null);
});

it('reports unfinished top-level `await`', async () => {
Expand Down Expand Up @@ -284,7 +285,7 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL },
});

it('still throws on `await` in an ordinary sync function', async () => {
const { stdout, stderr, code } = await spawnPromisified(process.execPath, [
const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [
'--eval',
'function fn() { await Promise.resolve(); } fn();',
]);
Expand All @@ -295,6 +296,7 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL },
);
strictEqual(stdout, '');
strictEqual(code, 1);
strictEqual(signal, null);
});

it('throws on undefined `require` when top-level `await` triggers ESM parsing', async () => {
Expand All @@ -313,7 +315,6 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL },
strictEqual(signal, null);
});


it('permits declaration of CommonJS module variables', async () => {
const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [
'--no-warnings',
Expand Down

0 comments on commit c3a13fb

Please sign in to comment.