mirror of
https://github.com/nodejs/node.git
synced 2026-10-10 18:59:49 -04:00
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>
39 lines
903 B
JavaScript
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');
|
|
}
|
|
},
|
|
},
|
|
);
|