Skip to content

Commit 2a21901

Browse files
committed
fixup! vm: allow dynamic import with a referrer realm
1 parent ee58562 commit 2a21901

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

test/parallel/test-vm-module-referrer-realm.js test/parallel/test-vm-module-referrer-realm.mjs

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Flags: --experimental-vm-modules
2-
'use strict';
3-
const common = require('../common');
4-
5-
const assert = require('assert');
6-
const { Script, SourceTextModule, createContext } = require('vm');
2+
import * as common from '../common/index.mjs';
3+
import assert from 'node:assert';
4+
import { Script, SourceTextModule, createContext } from 'node:vm';
75

86
async function test() {
97
const foo = new SourceTextModule('export const a = 1;');
@@ -23,7 +21,7 @@ async function test() {
2321
});
2422

2523
const result = s.runInContext(ctx);
26-
assert.strictEqual(foo.namespace, await result);
24+
assert.strictEqual(await result, foo.namespace);
2725
}
2826

2927
{
@@ -33,7 +31,7 @@ async function test() {
3331
});
3432
await m.link(common.mustNotCall());
3533
await m.evaluate();
36-
assert.strictEqual(foo.namespace, await ctx.fooResult);
34+
assert.strictEqual(await ctx.fooResult, foo.namespace);
3735
delete ctx.fooResult;
3836
}
3937
}
@@ -66,7 +64,5 @@ async function testMissing() {
6664
}
6765
}
6866

69-
(async function() {
70-
await test();
71-
await testMissing();
72-
}()).then(common.mustCall());
67+
await test();
68+
await testMissing();

0 commit comments

Comments
 (0)