Principle:Cypress io Cypress Test Runner Launch
| Knowledge Sources | |
|---|---|
| Domains | CLI, Process_Management |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A process spawning mechanism that launches the Cypress test runner as a child process with appropriate arguments for either interactive or headless execution modes.
Description
Launching a test runner requires bridging the gap between the lightweight npm-installed CLI and the full Electron-based test runner binary. Cypress uses a two-process architecture: the CLI process (cypress open or cypress run) validates arguments and spawns a child process that executes the actual Cypress server within the installed binary.
The open mode launches an interactive Electron window (the Launchpad), while run mode executes tests headlessly and exits with a status code. Both modes share the same spawning infrastructure but differ in their argument processing and lifecycle management.
Usage
Use this principle when understanding how Cypress transitions from CLI invocation to test execution. It applies every time a user runs cypress open (interactive) or cypress run (headless).
Theoretical Basis
CLI Invocation Flow:
cypress open/run
→ Parse CLI arguments
→ Verify binary installation
→ Map options to server arguments (processOpenOptions / processRunOptions)
→ spawn.start(args) → child_process.spawn(binaryPath, args)
→ Child process: Electron app starts Cypress server
→ Open mode: Interactive Launchpad UI
→ Run mode: Headless execution → exit code