mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
e738edce6a
Subsystems: blob, child_process, common, crypto, http, http2, readline, repl, snapshot, trace_events PR-URL: https://github.com/nodejs/node/pull/49127 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
34 lines
858 B
JavaScript
34 lines
858 B
JavaScript
'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 fs = require('fs');
|
|
|
|
tmpdir.refresh();
|
|
const blobPath = tmpdir.resolve('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));
|
|
}
|