/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v26.0.0
test/embedding/test-embedding-snapshot-without-code-cache.js
50 строк
1 KB
Joyee Cheung
test: split test-embedding.js and run tests in parallel
08 фев 2026, 16:18
Не верифицирован
08 фев 2026, 16:18
a879b39
Код
Авторство
О чём код?
'use strict'; // Tests node::SnapshotFlags::kWithoutCodeCache. See // embedtest.cc for more details. const common = require('../common'); const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const fixtures = require('../common/fixtures'); const { spawnSyncAndAssert, spawnSyncAndExitWithoutError, } = require('../common/child_process'); const snapshotFixture = fixtures.path('snapshot', 'echo-args.js'); const embedtest = common.resolveBuiltBinary('embedtest'); const buildSnapshotExecArgs = [ `eval(require("fs").readFileSync(${JSON.stringify(snapshotFixture)}, "utf8"))`, 'arg1', 'arg2', ]; const snapshotBlobArgs = [ '--embedder-snapshot-blob', tmpdir.resolve('embedder-snapshot.blob'), ]; const runSnapshotExecArgs = ['arg3', 'arg4']; tmpdir.refresh(); // Build the snapshot with the --without-code-cache flag. spawnSyncAndExitWithoutError( embedtest, ['--', ...buildSnapshotExecArgs, ...snapshotBlobArgs, '--without-code-cache', '--embedder-snapshot-create'], { cwd: tmpdir.path }); // Run the snapshot and check the serialized and refreshed argv values. spawnSyncAndAssert( embedtest, ['--', ...runSnapshotExecArgs, ...snapshotBlobArgs ], { cwd: tmpdir.path }, { stdout(output) { assert.deepStrictEqual(JSON.parse(output), { originalArgv: [embedtest, '__node_anonymous_main', ...buildSnapshotExecArgs], currentArgv: [embedtest, ...runSnapshotExecArgs], }); return true; }, });