mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-01 20:19:58 -06:00
fix: limit the number of globals defined due to the v8 snapshot (#25051)
This commit is contained in:
@@ -287,6 +287,21 @@ const runIntegrityTest = async function (buildAppExecutable, buildAppDir, e2e) {
|
||||
|
||||
await testAlteringEntryPoint('console.log("simple alteration")', 'Integrity check failed with expected stack length 9 but got 10')
|
||||
await testAlteringEntryPoint('console.log("accessing " + global.getSnapshotResult())', 'getSnapshotResult can only be called once')
|
||||
|
||||
function compareGlobals () {
|
||||
const childProcess = require('child_process')
|
||||
const nodeGlobalKeys = JSON.parse(childProcess.spawnSync('node -p "const x = Object.getOwnPropertyNames(global);JSON.stringify(x)"', { shell: true, encoding: 'utf8' }).stdout)
|
||||
|
||||
const extraKeys = Object.getOwnPropertyNames(global).filter((key) => {
|
||||
return !nodeGlobalKeys.includes(key)
|
||||
})
|
||||
|
||||
console.error(`extra keys in electron process: ${extraKeys}`)
|
||||
}
|
||||
|
||||
const allowList = ['regeneratorRuntime', '__core-js_shared__', 'getSnapshotResult', 'supportTypeScript']
|
||||
|
||||
await testAlteringEntryPoint(`(${compareGlobals.toString()})()`, `extra keys in electron process: ${allowList}\nIntegrity check failed with expected stack length 9 but got 10`)
|
||||
}
|
||||
|
||||
const test = async function (buildAppExecutable, buildAppDir) {
|
||||
|
||||
Reference in New Issue
Block a user