From a05ed709657240764d5aebc9522fa13f2de9c35a Mon Sep 17 00:00:00 2001 From: legendecas <legendecas@gmail.com> Date: Tue, 24 Oct 2023 23:56:02 +0800 Subject: [PATCH] fixup! vm: allow dynamic import with a referrer realm --- ...m.js => test-vm-module-referrer-realm.mjs} | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) rename test/parallel/{test-vm-module-referrer-realm.js => test-vm-module-referrer-realm.mjs} (82%) diff --git a/test/parallel/test-vm-module-referrer-realm.js b/test/parallel/test-vm-module-referrer-realm.mjs similarity index 82% rename from test/parallel/test-vm-module-referrer-realm.js rename to test/parallel/test-vm-module-referrer-realm.mjs index c65e177a8a0208..3957f147d8ee99 100644 --- a/test/parallel/test-vm-module-referrer-realm.js +++ b/test/parallel/test-vm-module-referrer-realm.mjs @@ -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;'); @@ -23,7 +21,7 @@ async function test() { }); const result = s.runInContext(ctx); - assert.strictEqual(foo.namespace, await result); + assert.strictEqual(await result, foo.namespace); } { @@ -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; } } @@ -66,7 +64,7 @@ async function testMissing() { } } -(async function() { - await test(); - await testMissing(); -}()).then(common.mustCall()); +await Promise.all([ + test(), + testMissing(), +]).then(common.mustCall());