pulsar/script/verify-snapshot-script
Antonio Scandurra 15d988d441 Use the Node version bundled in Electron to verify snapshot script
Previously, we used to verify the snapshot script by running it in a
new, empty context (similar to the one that `mksnapshot` creates when
generating the startup blob).

However, this context was being created using the Node version that
`script/build` was executed with. Such version may not match the Node
version shipped with Electron, and could thus cause the build script to
report "false negatives" when verifying the snapshot script. For
instance, running `script/build` with Node 4 would cause it to throw an
error when encountering keywords like `async`/`await`, even if they're
100% supported in Electron 1.6.9.

With this commit we are changing the snapshot verification code to use
the Node version bundled in Electron in order to avoid the
aforementioned mismatches.
2017-09-06 11:02:54 +02:00

7 lines
279 B
JavaScript
Executable File

#!/usr/bin/env node
const fs = require('fs')
const vm = require('vm')
const snapshotScriptPath = process.argv[2]
const snapshotScript = fs.readFileSync(snapshotScriptPath, 'utf8')
vm.runInNewContext(snapshotScript, undefined, {filename: snapshotScriptPath, displayErrors: true})