0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 20:29:23 +01:00
nodejs/test/common/wasi.js
Antoine du Hamel c714cda9a7
test: add spawnSyncAndAssert util
PR-URL: https://github.com/nodejs/node/pull/52132
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2024-03-20 19:44:14 +01:00

44 lines
925 B
JavaScript

// Test version set to preview1
'use strict';
const { spawnSyncAndAssert } = require('./child_process');
const fixtures = require('./fixtures');
const childPath = fixtures.path('wasi-preview-1.js');
function testWasiPreview1(args, spawnArgs = {}, expectations = {}) {
const newEnv = {
...process.env,
NODE_DEBUG_NATIVE: 'wasi',
NODE_PLATFORM: process.platform,
...spawnArgs.env,
};
spawnArgs.env = newEnv;
console.log('Testing with --turbo-fast-api-calls:', ...args);
spawnSyncAndAssert(
process.execPath, [
'--turbo-fast-api-calls',
childPath,
...args,
],
spawnArgs,
expectations,
);
console.log('Testing with --no-turbo-fast-api-calls:', ...args);
spawnSyncAndAssert(
process.execPath,
[
'--no-turbo-fast-api-calls',
childPath,
...args,
],
spawnArgs,
expectations,
);
}
module.exports = {
testWasiPreview1,
};