Skip to content

Commit 3bfa548

Browse files
committed
esm: unflag extensionless ES module JavaScript and Wasm in module scope
nodejs/node#49974
1 parent d2e55f9 commit 3bfa548

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

spec/esm-spec.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,19 @@ describe('esm', () => {
162162
});
163163

164164
describe('with context isolation', () => {
165+
let badFilePath = '';
166+
167+
beforeEach(async () => {
168+
badFilePath = path.resolve(path.resolve(os.tmpdir(), 'bad-file.badjs'));
169+
await fs.promises.writeFile(badFilePath, 'const foo = "bar";');
170+
});
171+
172+
afterEach(async () => {
173+
await fs.promises.unlink(badFilePath);
174+
});
175+
165176
it('should use nodes esm dynamic loader in the isolated context', async () => {
166-
const [, preloadError] = await loadWindowWithPreload(`await import(${JSON.stringify(hostsUrl)})`, {
177+
const [, preloadError] = await loadWindowWithPreload(`await import(${JSON.stringify((pathToFileURL(badFilePath)))})`, {
167178
nodeIntegration: true,
168179
sandbox: false,
169180
contextIsolation: true

0 commit comments

Comments
 (0)