Skip to content

Commit

Permalink
fixup! vm: allow dynamic import with a referrer realm
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas committed Oct 24, 2023
1 parent ee58562 commit a05ed70
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Flags: --experimental-vm-modules
'use strict';
const common = require('../common');

const assert = require('assert');
const { Script, SourceTextModule, createContext } = require('vm');
import * as common from '../common/index.mjs';
import assert from 'node:assert';
import { Script, SourceTextModule, createContext } from 'node:vm';

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

const result = s.runInContext(ctx);
assert.strictEqual(foo.namespace, await result);
assert.strictEqual(await result, foo.namespace);
}

{
Expand All @@ -33,7 +31,7 @@ async function test() {
});
await m.link(common.mustNotCall());
await m.evaluate();
assert.strictEqual(foo.namespace, await ctx.fooResult);
assert.strictEqual(await ctx.fooResult, foo.namespace);
delete ctx.fooResult;
}
}
Expand Down Expand Up @@ -66,7 +64,7 @@ async function testMissing() {
}
}

(async function() {
await test();
await testMissing();
}()).then(common.mustCall());
await Promise.all([
test(),
testMissing(),
]).then(common.mustCall());

0 comments on commit a05ed70

Please sign in to comment.