()
| 194 | |
| 195 | // Run the app once so the start bundle's code cache includes the functions that compile during startup |
| 196 | const 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 | |
| 230 | module.exports = { |
| 231 | createStartCypressBundle, |
no test coverage detected