MCPcopy Index your code
hub / github.com/nodejs/node / buildSnapshot

Function buildSnapshot

test/common/snapshot.js:8–35  ·  view source on GitHub ↗
(entry, env)

Source from the content-addressed store, hash-verified

6const assert = require('assert');
7
8function buildSnapshot(entry, env) {
9 const child = spawnSync(process.execPath, [
10 '--snapshot-blob',
11 tmpdir.resolve('snapshot.blob'),
12 '--build-snapshot',
13 entry,
14 ], {
15 cwd: tmpdir.path,
16 env: {
17 ...process.env,
18 ...env,
19 },
20 });
21
22 const stderr = child.stderr.toString();
23 const stdout = child.stdout.toString();
24 console.log('[stderr]');
25 console.log(stderr);
26 console.log('[stdout]');
27 console.log(stdout);
28
29 assert.strictEqual(child.status, 0);
30
31 const stats = fs.statSync(tmpdir.resolve('snapshot.blob'));
32 assert(stats.isFile());
33
34 return { child, stderr, stdout };
35}
36
37function runWithSnapshot(entry, env) {
38 const args = ['--snapshot-blob', tmpdir.resolve('snapshot.blob')];

Calls 7

spawnSyncFunction · 0.50
assertFunction · 0.50
resolveMethod · 0.45
toStringMethod · 0.45
logMethod · 0.45
statSyncMethod · 0.45
isFileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…