forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest-snapshot-worker.js
More file actions
34 lines (31 loc) · 896 Bytes
/
test-snapshot-worker.js
File metadata and controls
34 lines (31 loc) · 896 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
'use strict';
// This tests snapshot JS API using the example in the docs.
require('../common');
const assert = require('assert');
const { spawnSync } = require('child_process');
const tmpdir = require('../common/tmpdir');
const fixtures = require('../common/fixtures');
const path = require('path');
const fs = require('fs');
tmpdir.refresh();
const blobPath = path.join(tmpdir.path, 'snapshot.blob');
const entry = fixtures.path('snapshot', 'worker.js');
{
const child = spawnSync(process.execPath, [
'--snapshot-blob',
blobPath,
'--build-snapshot',
entry,
], {
cwd: tmpdir.path
});
const stderr = child.stderr.toString();
assert.match(
stderr,
/Error: Creating workers is not supported in startup snapshot/);
assert.match(
stderr,
/ERR_NOT_SUPPORTED_IN_SNAPSHOT/);
assert.strictEqual(child.status, 1);
assert(!fs.existsSync(blobPath));
}