MCPcopy Create free account
hub / github.com/cypress-io/cypress / createStartBundleCodeCache

Function createStartBundleCodeCache

scripts/binary/start-bundle.js:202–234  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

200
201// Run the app once so the start bundle's code cache includes the functions that compile during startup
202const createStartBundleCodeCache = async () => {
203 const args = ['--smoke-test', '--ping=1']
204
205 if (needsSandbox()) {
206 args.push('--no-sandbox')
207 }
208
209 // read after xvfb.start(), which sets DISPLAY
210 const getAppEnv = () => {
211 const env = { ...process.env, CYPRESS_INTERNAL_WRITE_START_BUNDLE_CACHE: '1' }
212
213 // only for this build-time run: the shipped cache is made without the build machine's NODE_OPTIONS,
214 // and the user's own NODE_OPTIONS still apply when they run Cypress
215 delete env.NODE_OPTIONS
216 delete env.ELECTRON_RUN_AS_NODE
217
218 return env
219 }
220
221 const usingXvfb = xvfb.isNeeded(getAppEnv())
222
223 try {
224 if (usingXvfb) {
225 await xvfb.start()
226 }
227
228 await execa(`${meta.buildAppExecutable()}`, args, { env: getAppEnv(), extendEnv: false })
229 } finally {
230 if (usingXvfb) {
231 await xvfb.stop()
232 }
233 }
234}
235
236module.exports = {
237 createStartCypressBundle,

Callers 1

after-pack-hook.jsFile · 0.85

Calls 5

needsSandboxFunction · 0.85
getAppEnvFunction · 0.85
stopMethod · 0.65
pushMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected