Files
node/test/sea/test-single-executable-application-vfs.js
Matteo Collina 4e207b1c34 sea: mount bundled assets as a virtual file system
Support "useVfs": true in the SEA configuration: mount the bundled
assets as a read-only VFS and run the CommonJS or ESM main script from
inside the mount.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/65675
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2026-09-03 10:52:15 +00:00

39 lines
903 B
JavaScript

'use strict';
// This tests the SEA VFS integration - the bundled assets are mounted as a
// virtual file system and the main script runs from inside the mount.
require('../common');
const {
buildSEA,
skipIfBuildSEAIsNotSupported,
} = require('../common/sea');
skipIfBuildSEAIsNotSupported();
const tmpdir = require('../common/tmpdir');
const { spawnSyncAndAssert } = require('../common/child_process');
const fixtures = require('../common/fixtures');
tmpdir.refresh();
const outputFile = buildSEA(fixtures.path('sea', 'vfs'));
spawnSyncAndAssert(
outputFile,
{
env: {
...process.env,
NODE_DEBUG_NATIVE: undefined,
},
},
{
stdout: /All SEA VFS tests passed!/,
stderr(stderr) {
if (/ExperimentalWarning: VirtualFileSystem/.test(stderr)) {
throw new Error('SEA VFS should not emit the public VirtualFileSystem warning');
}
},
},
);