Skip to content
Prev Previous commit
Next Next commit
add test for redeclaration above import/export
  • Loading branch information
GeoffreyBooth committed Mar 11, 2024
commit 91143388fcf00ec2c8f6aab7b723ce00d118e426
13 changes: 13 additions & 0 deletions test/es-module/test-esm-detect-ambiguous.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,19 @@ describe('--experimental-detect-module', { concurrency: true }, () => {
strictEqual(code, 0);
strictEqual(signal, null);
});

it('permits declaration of CommonJS module variables above import/export', async () => {
const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [
'--experimental-detect-module',
'--eval',
'const module = 3; import "node:os"; console.log("executed");',
]);

strictEqual(stderr, '');
strictEqual(stdout, 'executed\n');
strictEqual(code, 0);
strictEqual(signal, null);
});
});
});

Expand Down