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());