Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
e326df7
deps: V8: backport 209d2db9e24a
zengdage Sep 11, 2025
98f5e7c
deps: V8: cherry-pick highway@dcc0ca1cd42
richardlau Jan 16, 2026
f5f9b2d
test: ensure assertions are reached on more tests
aduh95 Nov 17, 2025
edf90ce
test: use `RegExp.escape` to improve test reliability
aduh95 Nov 23, 2025
141fb82
test: ensure assertions are reached on more tests
aduh95 Nov 24, 2025
5ee02c7
test: ensure assertions are reached on more tests
aduh95 Nov 17, 2025
335cb0b
test: ensure assertions are reached on all tests
aduh95 Nov 27, 2025
eebd732
tools: enforce trailing commas in `test/sequential`
aduh95 Dec 3, 2025
41adb54
tools: enforce trailing commas in `test/es-module`
aduh95 Nov 29, 2025
a49d543
test: enforce better never-settling-promise detection
aduh95 Dec 10, 2025
32cd18e
async_hooks: enabledHooksExist shall return if hooks are enabled
Flarna Dec 31, 2025
73c0a24
test: forbid use of named imports for fixtures
aduh95 Jan 1, 2026
320b576
deps: update zlib to 1.3.1-e00f703
nodejs-github-bot Jan 10, 2026
d597b8e
build,tools: fix addon build deadlock on errors
vmoroz Jan 11, 2026
098ec6f
deps: update ada to v3.4.0
anonrig Jan 8, 2026
89983cf
test: update url web-platform tests
anonrig Jan 8, 2026
e2df85a
meta: label v8 module PRs
Renegade334 Jan 11, 2026
a1a0f77
build: fix crate vendor file checksums on windows
legendecas Jan 11, 2026
13c0397
deps: update icu to 78.2
nodejs-github-bot Jan 11, 2026
637470e
build: fix misplaced comma in ldflags
hqzing Jan 11, 2026
2be98ad
doc: document ALPNCallback option for TLSSocket constructor
ikeyan Jan 10, 2026
5a984b9
src: use node- prefix on thread names
sxa Jan 6, 2026
adf5c84
doc: clean up writing-and-running-benchmarks.md
Hardanish-Singh Jan 13, 2026
a87f7a5
doc: run license-builder
github-actions[bot] Jan 14, 2026
588b00f
cluster: fix port reuse between cluster
islandryu Jan 14, 2026
90080d2
doc: restore @watilde to collaborators
watilde Jan 14, 2026
611c179
zlib: validate write_result array length
islandryu Jan 15, 2026
7e211e6
build: add embedtest into native suite
joyeecheung Jan 15, 2026
2db4893
esm: ensure watch mode restarts after syntax errors
Xstoudi Jan 15, 2026
3f17acf
test: add webidl web-platform tests
anonrig Jan 15, 2026
ff1fcab
test_runner: support expecting a test-case to fail
JakobJingleheimer Jan 15, 2026
6a3c614
deps: update sqlite to 3.51.2
nodejs-github-bot Jan 15, 2026
1d15955
doc: added 'secure' event to tls.TLSSocket
ikeyan Jan 16, 2026
3d23bcd
doc: add esm and cjs examples to node:v8
mfdebian Jan 16, 2026
f83cb1e
doc: packages: example of private import switch to internal
coderaiser Jan 16, 2026
8b73739
typings: add typing for string_decoder
kimtaejin3 Jan 16, 2026
39105e4
test: aix: mark test-emit-on-destroyed as flaky
sxa Jan 16, 2026
9f25cad
src: fix pointer alignment
jhofstee Jan 16, 2026
7697ce0
fs: remove duplicate fd validation in sync functions
mertcanaltin Jan 16, 2026
5ab8057
doc: add marco and rafael in last sec release
marco-ippolito Jan 16, 2026
72f1463
test: split test-esm-loader-hooks
joyeecheung Jan 16, 2026
4f30c21
node-api: use Node-API in comments
vmoroz Jan 16, 2026
a5a4c3e
test_runner: nix dead reporter code
vassudanagunta Jan 16, 2026
05ce2c8
tools: fix vcbuild lint-js-build
vmoroz Jan 16, 2026
778a56f
assert,util: fix deep comparison for sets and maps with mixed types
BridgeAR Jan 17, 2026
f3caf27
doc: add deprecation history for url.parse
Juneezee Jan 17, 2026
2423ecd
meta: fix typos in issue template config
watilde Jan 17, 2026
bacba16
fs: fix ENOTDIR in globSync when file is treated as dir
Han5991 Jan 17, 2026
f5803cc
test_runner: fix rerun ambiguous test failures
MoLow Jan 17, 2026
6e1beda
test_runner: print info when test restarts
Xstoudi Jan 17, 2026
399ac68
test_runner: fix coverage report when a directory is named file
heathdutton Jan 17, 2026
434fcd7
fs: fix errorOnExist behavior for directory copy in fs.cp
npaun Jan 17, 2026
ec1cbbe
test_runner: fix memory leaks in runner
abhishekSavani Nov 27, 2025
f55a5fe
lib: fix TypeScript support check in jitless mode
Han5991 Jan 14, 2026
2a8e8df
doc: refine WebAssembly error documentation
Han5991 Jan 15, 2026
d8a1cde
child_process: treat ipc length header as unsigned uint32
islandryu Jan 19, 2026
cf56327
http2: validate initialWindowSize per HTTP/2 spec
mcollina Jan 19, 2026
828feb2
events: remove redundant todo
gurgunday Jan 19, 2026
ca4ebed
tools: use ad-hoc flag to lint Nix files
aduh95 Jan 19, 2026
a132be7
test: check new WebCryptoAPI enum values
panva Jan 19, 2026
6a32a68
doc: note resume build should not be done on node-test-commit
sxa Jan 13, 2026
344cc62
src: use C++ nullptr in webstorage
tniessen Jan 19, 2026
3bb4815
test: reveal wpt evaluation errors in status files
legendecas Jan 19, 2026
86e2a76
build: infer cargo mode with gyp var build_type directly
legendecas Jan 19, 2026
1b4b5eb
build: update devcontainer.json to use paired nix env
joyeecheung Jan 19, 2026
069f360
sqlite: add sqlite prepare options args
araujogui Jan 19, 2026
6442229
sqlite: add some tests
araujogui Jan 19, 2026
77cacf6
src: use C++ nullptr in sqlite
tniessen Jan 19, 2026
99a4e51
crypto: update root certificates to NSS 3.119
nodejs-github-bot Jan 20, 2026
3d5e718
lib: fix typo in `util.js` comment
kimtaejin3 Jan 20, 2026
f289817
sqlite: enable defensive mode by default
louwers Jan 20, 2026
4bb00d7
deps: update googletest to 85087857ad10bd407cd6ed2f52f7ea9752db621f
nodejs-github-bot Jan 20, 2026
2a54209
src: use starts_with instead of rfind/find
tniessen Jan 20, 2026
58abe99
src: cache missing package.json files in the C++ package config cache
michaelsmithxyz Jan 20, 2026
214fac9
doc: update Python 3.14 manual install instructions (Windows)
MikeMcC399 Jan 20, 2026
ef01f0c
build,win: update WinGet configurations to Python 3.14
MikeMcC399 Jan 20, 2026
606184f
fs: remove duplicate getValidatedPath calls
mertcanaltin Jan 20, 2026
803ff7d
src: cache context lookup in vectored io loops
mertcanaltin Jan 20, 2026
a17016e
doc: clarify TypedArray properties on Buffer
silverwind Jan 20, 2026
94b34c3
doc: remove Windows Dev Home instructions from BUILDING
MikeMcC399 Jan 21, 2026
3331bdc
doc: clarify process.argv[1] behavior for -e/--eval
Jeevankumar-s Jan 21, 2026
8dd379d
build: update android-patches/trap-handler.h.patch
moluopro Jan 21, 2026
e9a3426
buffer: make methods work on Uint8Array instances
nbbeeken Jan 21, 2026
e35814b
src: add missing override specifier to Clean()
tniessen Jan 21, 2026
7c2242b
tools: validate release commit diff as part of `lint-release-proposal`
aduh95 Jan 21, 2026
4bbbe75
quic: move quic behind compile time flag
mcollina Jan 21, 2026
2939950
test: add implicit test for fs dispose handling with using
IlyasShabi Jan 21, 2026
df02d00
src: improve StringBytes::Encode perf on UTF8
ChALkeR Jan 21, 2026
ade4fc2
tools: copyedit Nix files
aduh95 Jan 22, 2026
c75ad3d
v8: add GCProfiler support for erm
IlyasShabi Jan 22, 2026
8255cde
build: add `--shared-nbytes` configure flag
aduh95 Jan 13, 2026
e88dd01
v8: changing total_allocated_bytes to avoid ABI changes
caiolima Jan 24, 2026
62d71eb
quic: copy options.certs buffer instead of detaching
legendecas Jan 22, 2026
bcffca8
test: aix: mark test_threadsafe_function/test flaky on AIX
sxa Jan 20, 2026
0fb4642
doc: include OpenJSF handle for security stewards
RafaelGSS Jan 22, 2026
b5cdc27
build,win: improve logs when ClangCL is missing
MikeMcC399 Jan 22, 2026
24033ee
http: fix rawHeaders exceeding maxHeadersCount limit
Meltedd Jan 22, 2026
cabd58f
test: use fixture directories for sea tests
joyeecheung Jan 1, 2026
0feab0f
deps: add tools and scripts to pull LIEF as a dependency
joyeecheung Dec 22, 2025
fbe4da5
deps: add LIEF as a dependency
joyeecheung Dec 22, 2025
957292e
sea: split sea binary manipulation code
joyeecheung Dec 22, 2025
b351910
sea: add --build-sea to generate SEA directly with Node.js binary
joyeecheung Dec 23, 2025
75c06bc
test: migrate to --build-sea in existing SEA tests
joyeecheung Jan 2, 2026
e91b296
fs: add ignore option to fs.watch
mcollina Jan 22, 2026
bc9e5f7
node-api: fix node_api_create_object_with_properties name
vmoroz Jan 23, 2026
0729fb6
doc: update previous version links in BUILDING
MikeMcC399 Jan 23, 2026
d4cf423
stream: export namespace object from internal end-of-stream module
Renegade334 Jan 23, 2026
696935e
inspector: initial support storage inspection
islandryu Jan 23, 2026
8abd54f
gyp: aix: change gcc version detection so CXX="ccache g++" works
sxa Jan 23, 2026
236d7ee
doc: add CVE delay mention
RafaelGSS Jan 23, 2026
482b256
benchmark: add SQLite benchmarks
araujogui Jan 23, 2026
048f7a5
deps: upgrade npm to 11.8.0
npm-cli-bot Jan 23, 2026
7d8232e
test: add some validation for JSON doc output
aduh95 Jan 23, 2026
b3fbc3c
meta: do not fast-track npm updates
aduh95 Jan 24, 2026
b6cc5d7
doc: mention constructor comparison in assert.deepStrictEqual
hamzakargin Jan 24, 2026
ccfd9d9
doc: remove `v` prefix for version references
MikeMcC399 Jan 25, 2026
1751d19
2026-01-26, Version 25.5.0 (Current)
aduh95 Jan 26, 2026
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: use fixture directories for sea tests
Instead of copying and writing files on the fly for SEA tests,
put the fixtures into a directory and copy them into tmpdir
for testing. This allows easier reproduction and debugging
when they do fail - we can just copy the entire fixture directory
and test directly from there.

PR-URL: #61167
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
  • Loading branch information
joyeecheung authored and aduh95 committed Jan 24, 2026
commit cabd58f1cbd26859f413d0c4a8d8f3efbf228713
58 changes: 50 additions & 8 deletions test/common/sea.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const common = require('../common');
const fixtures = require('../common/fixtures');
const tmpdir = require('../common/tmpdir');
const { inspect } = require('util');
const fs = require('fs');
const path = require('path');
const assert = require('assert');

const { readFileSync, copyFileSync, statSync } = require('fs');
const {
Expand Down Expand Up @@ -70,37 +73,76 @@ function skipIfSingleExecutableIsNotSupported() {
}
}

function generateSEA(targetExecutable, sourceExecutable, seaBlob, verifyWorkflow = false) {
function generateSEA(fixtureDir, options = {}) {
const {
workingDir = tmpdir.path,
configPath = 'sea-config.json',
verifyWorkflow = false,
} = options;
// Copy fixture files to working directory if they are different.
if (fixtureDir !== workingDir) {
fs.cpSync(fixtureDir, workingDir, { recursive: true });
}

// Determine the output executable path.
const outputFile = path.resolve(workingDir, process.platform === 'win32' ? 'sea.exe' : 'sea');

try {
copyFileSync(sourceExecutable, targetExecutable);
// Copy the executable.
copyFileSync(process.execPath, outputFile);
console.log(`Copied ${process.execPath} to ${outputFile}`);
} catch (e) {
const message = `Cannot copy ${sourceExecutable} to ${targetExecutable}: ${inspect(e)}`;
const message = `Cannot copy ${process.execPath} to ${outputFile}: ${inspect(e)}`;
if (verifyWorkflow) {
throw new Error(message);
}
common.skip(message);
}
console.log(`Copied ${sourceExecutable} to ${targetExecutable}`);

// Generate the blob using --experimental-sea-config.
spawnSyncAndExitWithoutError(
process.execPath,
['--experimental-sea-config', configPath],
{
cwd: workingDir,
env: {
NODE_DEBUG_NATIVE: 'SEA',
...process.env,
},
},
);

// Parse the config to get the output file path.
const config = JSON.parse(fs.readFileSync(path.resolve(workingDir, configPath)));
assert.strictEqual(typeof config.output, 'string');
const seaPrepBlob = path.resolve(workingDir, config.output);
assert(fs.existsSync(seaPrepBlob), `Expected SEA blob ${seaPrepBlob} to exist`);

// Use postject to inject the blob.
const postjectFile = fixtures.path('postject-copy', 'node_modules', 'postject', 'dist', 'cli.js');
try {
spawnSyncAndExitWithoutError(process.execPath, [
postjectFile,
targetExecutable,
outputFile,
'NODE_SEA_BLOB',
seaBlob,
seaPrepBlob,
'--sentinel-fuse', 'NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2',
...process.platform === 'darwin' ? [ '--macho-segment-name', 'NODE_SEA' ] : [],
]);
} catch (e) {
const message = `Cannot inject ${seaBlob} into ${targetExecutable}: ${inspect(e)}`;
const message = `Cannot inject ${seaPrepBlob} into ${outputFile}: ${inspect(e)}`;
if (verifyWorkflow) {
throw new Error(message);
}
common.skip(message);
}
console.log(`Injected ${seaBlob} into ${targetExecutable}`);
console.log(`Injected ${seaPrepBlob} into ${outputFile}`);

signSEA(outputFile, verifyWorkflow);
return outputFile;
}

function signSEA(targetExecutable, verifyWorkflow = false) {
if (process.platform === 'darwin') {
try {
spawnSyncAndExitWithoutError('codesign', [ '--sign', '-', targetExecutable ]);
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/sea/addon/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"disableExperimentalSEAWarning": true,
"assets": {
"hello.node": "binding.node"
}
}
9 changes: 9 additions & 0 deletions test/fixtures/sea/addon/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const sea = require('node:sea');
const fs = require('fs');
const path = require('path');

const addonPath = path.join(process.cwd(), 'hello.node');
fs.writeFileSync(addonPath, new Uint8Array(sea.getRawAsset('hello.node')));
const mod = {exports: {}};
process.dlopen(mod, addonPath);
console.log('hello,', mod.exports.hello());
4 changes: 4 additions & 0 deletions test/fixtures/sea/asset-keys-empty/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "sea.js",
"output": "sea-prep.blob"
}
1 change: 1 addition & 0 deletions test/fixtures/sea/asset-keys/asset-1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is asset 1
1 change: 1 addition & 0 deletions test/fixtures/sea/asset-keys/asset-2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is asset 2
1 change: 1 addition & 0 deletions test/fixtures/sea/asset-keys/asset-3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is asset 3
9 changes: 9 additions & 0 deletions test/fixtures/sea/asset-keys/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"assets": {
"asset-1.txt": "asset-1.txt",
"asset-2.txt": "asset-2.txt",
"asset-3.txt": "asset-3.txt"
}
}
9 changes: 9 additions & 0 deletions test/fixtures/sea/asset-keys/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

const { isSea, getAssetKeys } = require('node:sea');
const assert = require('node:assert');

assert(isSea());

const keys = getAssetKeys();
console.log('Asset keys:', JSON.stringify(keys.sort()));
5 changes: 5 additions & 0 deletions test/fixtures/sea/assets-invalid-type/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"assets": "invalid"
}
3 changes: 3 additions & 0 deletions test/fixtures/sea/assets-invalid-type/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';
// This file is used for testing invalid "assets" configuration.
// It should not be executed because the configuration should fail.
7 changes: 7 additions & 0 deletions test/fixtures/sea/assets-nonexistent-file/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"assets": {
"nonexistent": "nonexistent.txt"
}
}
3 changes: 3 additions & 0 deletions test/fixtures/sea/assets-nonexistent-file/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';
// This file is used for testing nonexistent asset file.
// It should not be executed because the configuration should fail.
Binary file added test/fixtures/sea/assets-raw/person.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions test/fixtures/sea/assets-raw/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"assets": {
"person.jpg": "person.jpg"
}
}
File renamed without changes.
Binary file added test/fixtures/sea/assets/person.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions test/fixtures/sea/assets/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"assets": {
"utf8_test_text.txt": "utf8_test_text.txt",
"person.jpg": "person.jpg"
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions test/fixtures/sea/assets/utf8_test_text.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
永和九年,嵗在癸丑,暮春之初,會於會稽山隂之蘭亭,脩稧事也。羣賢畢至,少長咸集。此地有崇山峻領,茂林脩竹;又有清流激湍,暎帶左右。引以為流觴曲水,列坐其次。雖無絲竹管弦之盛,一觴一詠,亦足以暢敘幽情。是日也,天朗氣清,恵風和暢;仰觀宇宙之大,俯察品類之盛;所以遊目騁懐,足以極視聽之娛,信可樂也。夫人之相與,俯仰一世,或取諸懐抱,悟言一室之內,或因寄所託,放浪形骸之外。雖趣舎萬殊,靜躁��同,當其欣扵所遇,暫得扵己,怏然自足,不知老之將至。及其所之既惓,情隨事遷,感慨係之矣。向之所欣,俛仰之閒以為陳跡,猶不能不以之興懐;況脩短隨化,終期扵盡。古人云:「死生亦大矣。」豈不痛哉!每攬昔人興感之由,若合一契,未嘗不臨文嗟悼,不能喻之扵懐。固知一死生為虛誕,齊彭殤為妄作。後之視今,亦由今之視昔,悲夫!故列敘時人,錄其所述,雖世殊事異,所以興懐,其致一也。後之攬者,亦將有感扵斯文。
3 changes: 3 additions & 0 deletions test/fixtures/sea/disable-experimental-warning/requirable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
hello: 'world',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"disableExperimentalSEAWarning": true
}
64 changes: 64 additions & 0 deletions test/fixtures/sea/disable-experimental-warning/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const { Module: { createRequire } } = require('module');
const createdRequire = createRequire(__filename);

// Although, require('../common') works locally, that couldn't be used here
// because we set NODE_TEST_DIR=/Users/iojs/node-tmp on Jenkins CI.
const { expectWarning, mustNotCall } = createdRequire(process.env.COMMON_DIRECTORY);

const builtinWarning =
`Currently the require() provided to the main script embedded into single-executable applications only supports loading built-in modules.
To load a module from disk after the single executable application is launched, use require("module").createRequire().
Support for bundled module loading or virtual file systems are under discussions in https://github.com/nodejs/single-executable`;

// This additionally makes sure that no unexpected warnings are emitted.
if (!createdRequire('./sea-config.json').disableExperimentalSEAWarning) {
expectWarning('Warning', builtinWarning); // Triggered by require() calls below.
expectWarning('ExperimentalWarning',
'Single executable application is an experimental feature and ' +
'might change at any time');
// Any unexpected warning would throw this error:
// https://github.com/nodejs/node/blob/c301404105a7256b79a0b8c4522ce47af96dfa17/test/common/index.js#L697-L700.
}

// Should be possible to require core modules that optionally require the
// "node:" scheme.
const { deepStrictEqual, strictEqual, throws } = require('assert');
const { dirname } = require('node:path');

// Checks that the source filename is used in the error stack trace.
strictEqual(new Error('lol').stack.split('\n')[1], ' at sea.js:29:13');

// Should be possible to require a core module that requires using the "node:"
// scheme.
{
const { test } = require('node:test');
strictEqual(typeof test, 'function');
}

// Should not be possible to require a core module without the "node:" scheme if
// it requires using the "node:" scheme.
throws(() => require('test'), {
code: 'ERR_UNKNOWN_BUILTIN_MODULE',
});

deepStrictEqual(process.argv, [process.execPath, process.execPath, '-a', '--b=c', 'd']);

strictEqual(require.cache, undefined);
strictEqual(require.extensions, undefined);
strictEqual(require.main, module);
strictEqual(require.resolve, undefined);

strictEqual(__filename, process.execPath);
strictEqual(__dirname, dirname(process.execPath));
strictEqual(module.exports, exports);

throws(() => require('./requirable.js'), {
code: 'ERR_UNKNOWN_BUILTIN_MODULE',
});

const requirable = createdRequire('./requirable.js');
deepStrictEqual(requirable, {
hello: 'world',
});

console.log('Hello, world! 😊');
Empty file.
4 changes: 4 additions & 0 deletions test/fixtures/sea/empty/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "empty.js",
"output": "sea-prep.blob"
}
6 changes: 6 additions & 0 deletions test/fixtures/sea/exec-argv-empty/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"disableExperimentalSEAWarning": true,
"execArgv": []
}
6 changes: 6 additions & 0 deletions test/fixtures/sea/exec-argv-empty/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const assert = require('assert');

console.log('process.argv:', JSON.stringify(process.argv));
assert.strictEqual(process.argv[2], 'user-arg');
assert.deepStrictEqual(process.execArgv, []);
console.log('empty execArgv test passed');
7 changes: 7 additions & 0 deletions test/fixtures/sea/exec-argv-extension-cli/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"disableExperimentalSEAWarning": true,
"execArgv": ["--no-warnings"],
"execArgvExtension": "cli"
}
14 changes: 14 additions & 0 deletions test/fixtures/sea/exec-argv-extension-cli/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const assert = require('assert');

console.log('process.argv:', JSON.stringify(process.argv));
console.log('process.execArgv:', JSON.stringify(process.execArgv));

// Should have execArgv from SEA config + CLI --node-options
assert.deepStrictEqual(process.execArgv, ['--no-warnings', '--max-old-space-size=1024']);

assert.deepStrictEqual(process.argv.slice(2), [
'user-arg1',
'user-arg2'
]);

console.log('execArgvExtension cli test passed');
7 changes: 7 additions & 0 deletions test/fixtures/sea/exec-argv-extension-env/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"disableExperimentalSEAWarning": true,
"execArgv": ["--no-warnings"],
"execArgvExtension": "env"
}
19 changes: 19 additions & 0 deletions test/fixtures/sea/exec-argv-extension-env/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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));

// Should have execArgv from SEA config.
// Note that flags from NODE_OPTIONS are not included in process.execArgv no matter it's
// an SEA or not, but we can test whether it works by checking that the warning emitted
// above was silenced.
assert.deepStrictEqual(process.execArgv, ['--no-warnings']);

assert.deepStrictEqual(process.argv.slice(2), [
'user-arg1',
'user-arg2'
]);

console.log('execArgvExtension env test passed');
7 changes: 7 additions & 0 deletions test/fixtures/sea/exec-argv-extension-none/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"disableExperimentalSEAWarning": true,
"execArgv": ["--no-warnings"],
"execArgvExtension": "none"
}
14 changes: 14 additions & 0 deletions test/fixtures/sea/exec-argv-extension-none/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const assert = require('assert');

console.log('process.argv:', JSON.stringify(process.argv));
console.log('process.execArgv:', JSON.stringify(process.execArgv));

// Should only have execArgv from SEA config, no NODE_OPTIONS
assert.deepStrictEqual(process.execArgv, ['--no-warnings']);

assert.deepStrictEqual(process.argv.slice(2), [
'user-arg1',
'user-arg2'
]);

console.log('execArgvExtension none test passed');
6 changes: 6 additions & 0 deletions test/fixtures/sea/exec-argv/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"main": "sea.js",
"output": "sea-prep.blob",
"disableExperimentalSEAWarning": true,
"execArgv": ["--no-warnings", "--max-old-space-size=2048"]
}
18 changes: 18 additions & 0 deletions test/fixtures/sea/exec-argv/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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');
4 changes: 4 additions & 0 deletions test/fixtures/sea/inspect-in-sea-flags/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "sea.js",
"output": "sea-prep.blob"
}
1 change: 1 addition & 0 deletions test/fixtures/sea/inspect-in-sea-flags/sea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log(process.argv);
1 change: 1 addition & 0 deletions test/fixtures/sea/inspect/hello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('Hello, world!');
4 changes: 4 additions & 0 deletions test/fixtures/sea/inspect/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "hello.js",
"output": "sea-prep.blob"
}
3 changes: 3 additions & 0 deletions test/fixtures/sea/simple/requirable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
hello: 'world',
};
Loading