CodeVetter · Repo Unpack · Data flow
cypress-io/cypress
Inputs cross explicit boundaries through CLI argument translation, configuration IPC, GraphQL operations, and network-event frames. State is split between DataContext, browser route/command state, server interception state, and local persistence. Outputs include browser responses, UI subscriptions, JSON run results, process exit codes, and session discovery records.
- processRunOptions translates user options into binary flags, including --run-project, config/env, recording key, reporter, and specs; spawn.start adds cwd, userNodePath, and userNodeVersion.
- Configuration crosses into a child as project/config arguments and inherited environment; RunPlugins sends modified setupConfig and event registrations back through setupTestingType:reply.
- GraphQL socket requests parse JSON and query text, execute graphqlSchema with a request context, return results through a callback, and balance DataContext active-request accounting in finally.
- The driver annotates regex/glob matchers for transport, lowercases header matcher names, stores handlers locally by routeId, and emits route:added; the server restores matcher types and appends BackendRoute to state.routes.
- Matching excludes component dev-server paths and can synthesize preflight responses; matchRoutes orders middleware first, ordinary handlers in reverse registration order, and excludes disabled routes.
- Interception buffers request/response bodies, preserves binary content, exchanges subscription events with browser handlers, merges changes, and either ends a stubbed request or continues transport with a modified body stream.
- Interactive-session JSON holds schema, PID, resolved project root, port, session ID, and testing type; CDP/browser attachment remains in memory, while the probe reads machine/user identity at request time.
- runSpecs aggregates per-spec statistics, transforms results with createPublicRunResults, invokes after:run, and writes output; programmatic run() supplies a temporary output path and reads that JSON after the child finishes.