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

Function createStartBundleCodeCache

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

Source from the content-addressed store, hash-verified

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