-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v8: fix ERR_NOT_BUILDING_SNAPSHOT is not a constructor
PR-URL: #47721 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
- Loading branch information
1 parent
933673d
commit 4729d30
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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', | ||
}); |