1'use strict';
2
3require('../common');
4const assert = require('assert');
5
6const {
7  isBuildingSnapshot,
8  addSerializeCallback,
9  addDeserializeCallback,
10  setDeserializeMainFunction
11} = require('v8').startupSnapshot;
12
13// This test verifies that the v8.startupSnapshot APIs are not available when
14// it is not building snapshot.
15
16assert(!isBuildingSnapshot());
17
18assert.throws(() => addSerializeCallback(() => {}), {
19  code: 'ERR_NOT_BUILDING_SNAPSHOT',
20});
21assert.throws(() => addDeserializeCallback(() => {}), {
22  code: 'ERR_NOT_BUILDING_SNAPSHOT',
23});
24assert.throws(() => setDeserializeMainFunction(() => {}), {
25  code: 'ERR_NOT_BUILDING_SNAPSHOT',
26});
27