forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-snapshot-cwd.js
More file actions
47 lines (41 loc) · 911 Bytes
/
test-snapshot-cwd.js
File metadata and controls
47 lines (41 loc) · 911 Bytes
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
'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 fs = require('fs');
tmpdir.refresh();
const blobPath = tmpdir.resolve('snapshot.blob');
const file = fixtures.path('snapshot', 'cwd.js');
const subdir = tmpdir.resolve('foo');
fs.mkdirSync(subdir);
{
// Create the snapshot.
spawnSyncAndAssert(process.execPath, [
'--snapshot-blob',
blobPath,
'--build-snapshot',
file,
], {
cwd: tmpdir.path,
encoding: 'utf8'
}, {
status: 0,
});
}
{
spawnSyncAndAssert(process.execPath, [
'--snapshot-blob',
blobPath,
file,
], {
cwd: subdir,
encoding: 'utf8'
}, {
status: 0,
trim: true,
stdout: subdir,
});
}