node/test/fixtures/sea-exec-argv.js
Joyee Cheung 3fc70198e0
sea: support execArgv in sea config
The `execArgv` field can be used to specify Node.js-specific
arguments that will be automatically applied when the single
executable application starts. This allows application developers
to configure Node.js runtime options without requiring end users
to be aware of these flags.

PR-URL: https://github.com/nodejs/node/pull/59314
Refs: https://github.com/nodejs/node/issues/51688
Refs: https://github.com/nodejs/node/issues/55573
Refs: https://github.com/nodejs/single-executable/issues/100
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2025-08-17 08:31:32 +00:00

19 lines
652 B
JavaScript

const assert = require('assert');
process.emitWarning('This warning should not be shown in the output', 'TestWarning');
console.log('process.argv:', JSON.stringify(process.argv));
console.log('process.execArgv:', JSON.stringify(process.execArgv));
assert.deepStrictEqual(process.execArgv, [ '--no-warnings', '--max-old-space-size=2048' ]);
// We start from 2, because in SEA, the index 1 would be the same as the execPath
// to accommodate the general expectation that index 1 is the path to script for
// applications.
assert.deepStrictEqual(process.argv.slice(2), [
'user-arg1',
'user-arg2'
]);
console.log('multiple execArgv test passed');