mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
test: log more information in SEA tests
- Use spawnSyncAndExitWithoutError to log more information on error. - Use NODE_DEBUG_NATIVE to log internals - Skip the test when available disk space < 120MB PR-URL: https://github.com/nodejs/node/pull/50759 Refs: https://github.com/nodejs/node/issues/50740 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
parent
973f30b16f
commit
a3ee1870fd
7 changed files with 106 additions and 35 deletions
|
@ -15,9 +15,8 @@ skipIfSingleExecutableIsNotSupported();
|
|||
const fixtures = require('../common/fixtures');
|
||||
const tmpdir = require('../common/tmpdir');
|
||||
const { copyFileSync, writeFileSync, existsSync } = require('fs');
|
||||
const { execFileSync } = require('child_process');
|
||||
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
|
||||
const { join } = require('path');
|
||||
const { strictEqual } = require('assert');
|
||||
const assert = require('assert');
|
||||
|
||||
const inputFile = fixtures.path('sea.js');
|
||||
|
@ -44,17 +43,32 @@ writeFileSync(configFile, `
|
|||
|
||||
// Copy input to working directory
|
||||
copyFileSync(inputFile, tmpdir.resolve('sea.js'));
|
||||
execFileSync(process.execPath, ['--experimental-sea-config', 'sea-config.json'], {
|
||||
cwd: tmpdir.path
|
||||
});
|
||||
spawnSyncAndExitWithoutError(
|
||||
process.execPath,
|
||||
['--experimental-sea-config', 'sea-config.json'],
|
||||
{
|
||||
cwd: tmpdir.path,
|
||||
env: {
|
||||
NODE_DEBUG_NATIVE: 'SEA',
|
||||
...process.env,
|
||||
},
|
||||
});
|
||||
|
||||
assert(existsSync(seaPrepBlob));
|
||||
|
||||
copyFileSync(process.execPath, outputFile);
|
||||
injectAndCodeSign(outputFile, seaPrepBlob);
|
||||
|
||||
const singleExecutableApplicationOutput = execFileSync(
|
||||
spawnSyncAndExitWithoutError(
|
||||
outputFile,
|
||||
[ '-a', '--b=c', 'd' ],
|
||||
{ env: { COMMON_DIRECTORY: join(__dirname, '..', 'common') } });
|
||||
strictEqual(singleExecutableApplicationOutput.toString(), 'Hello, world! 😊\n');
|
||||
{
|
||||
env: {
|
||||
COMMON_DIRECTORY: join(__dirname, '..', 'common'),
|
||||
NODE_DEBUG_NATIVE: 'SEA',
|
||||
...process.env,
|
||||
}
|
||||
},
|
||||
{
|
||||
stdout: 'Hello, world! 😊\n'
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue