esm: add support for dynamic source phase hook · nodejs/node@308f4ca

@@ -124,8 +124,7 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () =>

124124

strictEqual(code, 0);

125125

});

126126127-

// TODO: Enable this once https://github.com/nodejs/node/pull/56842 lands.

128-

it.skip('should support dynamic source phase imports', async () => {

127+

it('should support dynamic source phase imports', async () => {

129128

const { code, stderr, stdout } = await spawnPromisified(execPath, [

130129

'--no-warnings',

131130

'--experimental-wasm-modules',

@@ -166,8 +165,7 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () =>

166165

strictEqual(code, 0);

167166

});

168167169-

// TODO: Enable this once https://github.com/nodejs/node/pull/56842 lands.

170-

it.skip('should not execute dynamic source phase imports', async () => {

168+

it('should not execute dynamic source phase imports', async () => {

171169

const { code, stderr, stdout } = await spawnPromisified(execPath, [

172170

'--no-warnings',

173171

'--experimental-wasm-modules',

@@ -181,8 +179,7 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () =>

181179

strictEqual(code, 0);

182180

});

183181184-

// TODO: Enable this once https://github.com/nodejs/node/pull/56842 lands.

185-

it.skip('should throw for dynamic source phase imports not defined', async () => {

182+

it('should throw for dynamic source phase imports not defined', async () => {

186183

const fileUrl = fixtures.fileURL('es-modules/wasm-source-phase.js');

187184

const { code, stderr, stdout } = await spawnPromisified(execPath, [

188185

'--no-warnings',

@@ -195,6 +192,7 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () =>

195192

' strictEqual(e instanceof SyntaxError, true);',

196193

' strictEqual(e.message.includes("Source phase import object is not defined for module"), true);',

197194

` strictEqual(e.message.includes(${JSON.stringify(fileUrl)}), true);`,

195+

` return true`,

198196

'});',

199197

].join('\n'),

200198

]);

@@ -238,8 +236,7 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () =>

238236

notStrictEqual(code, 0);

239237

});

240238241-

// TODO: Enable this once https://github.com/nodejs/node/pull/56842 lands.

242-

it.skip('should throw for vm source phase dynamic import', async () => {

239+

it('should throw for vm source phase dynamic import', async () => {

243240

const { code, stderr, stdout } = await spawnPromisified(execPath, [

244241

'--no-warnings',

245242

'--experimental-wasm-modules',