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 2a21901
Showing 1 changed file with 7 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,5 @@ async function testMissing() {
}
}

(async function() {
await test();
await testMissing();
}()).then(common.mustCall());
await test();
await testMissing();

0 comments on commit 2a21901

Please sign in to comment.