forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-snapshot-child-process-sync.js
More file actions
53 lines (48 loc) · 1.11 KB
/
test-snapshot-child-process-sync.js
File metadata and controls
53 lines (48 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use strict';
// This tests that process.cwd() is accurate when
// restoring state from a snapshot
require('../common');
const { spawnSyncAndAssert } = require('../common/child_process');
const tmpdir = require('../common/tmpdir');
const fixtures = require('../common/fixtures');
const assert = require('assert');
tmpdir.refresh();
const blobPath = tmpdir.resolve('snapshot.blob');
const file = fixtures.path('snapshot', 'child-process-sync.js');
const expected = [
'From child process spawnSync',
'From child process execSync',
'From child process execFileSync',
];
{
// Create the snapshot.
spawnSyncAndAssert(process.execPath, [
'--snapshot-blob',
blobPath,
'--build-snapshot',
file,
], {
cwd: tmpdir.path,
}, {
trim: true,
stdout(output) {
assert.deepStrictEqual(output.split('\n'), expected);
return true;
}
});
}
{
spawnSyncAndAssert(process.execPath, [
'--snapshot-blob',
blobPath,
file,
], {
cwd: tmpdir.path,
}, {
trim: true,
stdout(output) {
assert.deepStrictEqual(output.split('\n'), expected);
return true;
}
});
}