summaryrefslogtreecommitdiff
path: root/test/parallel/test-v8-startup-snapshot-api.js
blob: c3738911540fc14c87720c537fe7feda27e08a71 (plain)
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
'use strict';

require('../common');
const assert = require('assert');

const {
  isBuildingSnapshot,
  addSerializeCallback,
  addDeserializeCallback,
  setDeserializeMainFunction
} = require('v8').startupSnapshot;

// This test verifies that the v8.startupSnapshot APIs are not available when
// it is not building snapshot.

assert(!isBuildingSnapshot());

assert.throws(() => addSerializeCallback(() => {}), {
  code: 'ERR_NOT_BUILDING_SNAPSHOT',
});
assert.throws(() => addDeserializeCallback(() => {}), {
  code: 'ERR_NOT_BUILDING_SNAPSHOT',
});
assert.throws(() => setDeserializeMainFunction(() => {}), {
  code: 'ERR_NOT_BUILDING_SNAPSHOT',
});