Instead of relying on a WASM build of postject to perform the injection, add LIEF as dependency and generate the SEA directly from core via a new CLI option --build-sea which takes the SEA config. This simplifies SEA generation for users and makes it easier to debug/maintain the SEA building process. PR-URL: https://github.com/nodejs/node/pull/61167 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
74 lines
1.8 KiB
JavaScript
74 lines
1.8 KiB
JavaScript
// This tests --build-sea when boolean fields have invalid types.
|
|
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const tmpdir = require('../common/tmpdir');
|
|
const { skipIfBuildSEAIsNotSupported } = require('../common/sea');
|
|
const { writeFileSync } = require('fs');
|
|
const { spawnSyncAndAssert } = require('../common/child_process');
|
|
|
|
skipIfBuildSEAIsNotSupported();
|
|
|
|
// Test: Invalid "disableExperimentalSEAWarning" type (should be Boolean)
|
|
{
|
|
tmpdir.refresh();
|
|
const config = tmpdir.resolve('invalid-disableExperimentalSEAWarning.json');
|
|
writeFileSync(config, `
|
|
{
|
|
"main": "bundle.js",
|
|
"output": "sea",
|
|
"disableExperimentalSEAWarning": "true"
|
|
}
|
|
`, 'utf8');
|
|
spawnSyncAndAssert(
|
|
process.execPath,
|
|
['--build-sea', config], {
|
|
cwd: tmpdir.path,
|
|
}, {
|
|
status: 1,
|
|
stderr: /"disableExperimentalSEAWarning" field of .*invalid-disableExperimentalSEAWarning\.json is not a Boolean/,
|
|
});
|
|
}
|
|
|
|
// Test: Invalid "useSnapshot" type (should be Boolean)
|
|
{
|
|
tmpdir.refresh();
|
|
const config = tmpdir.resolve('invalid-useSnapshot.json');
|
|
writeFileSync(config, `
|
|
{
|
|
"main": "bundle.js",
|
|
"output": "sea",
|
|
"useSnapshot": "false"
|
|
}
|
|
`, 'utf8');
|
|
spawnSyncAndAssert(
|
|
process.execPath,
|
|
['--build-sea', config], {
|
|
cwd: tmpdir.path,
|
|
}, {
|
|
status: 1,
|
|
stderr: /"useSnapshot" field of .*invalid-useSnapshot\.json is not a Boolean/,
|
|
});
|
|
}
|
|
|
|
// Test: Invalid "useCodeCache" type (should be Boolean)
|
|
{
|
|
tmpdir.refresh();
|
|
const config = tmpdir.resolve('invalid-useCodeCache.json');
|
|
writeFileSync(config, `
|
|
{
|
|
"main": "bundle.js",
|
|
"output": "sea",
|
|
"useCodeCache": 1
|
|
}
|
|
`, 'utf8');
|
|
spawnSyncAndAssert(
|
|
process.execPath,
|
|
['--build-sea', config], {
|
|
cwd: tmpdir.path,
|
|
}, {
|
|
status: 1,
|
|
stderr: /"useCodeCache" field of .*invalid-useCodeCache\.json is not a Boolean/,
|
|
});
|
|
}
|