feat!: the app under test is declared on its target, engines keep only url, identity, environment

Closed
OK
2mo ago
+558-316

First of three: this moves the app declaration to the target and shrinks the engine's to the defaults it can know. Run-level services and a run-wide port view follow in stacked PRs.

  • Target.app carries url, environment, identity, command, readyUrl, services. Every field overrides the engine's default; the processes are the target's alone (packages/e2e/src/config/app.ts, mergeAppDeclaration).
  • EngineAppDeclaration is url, environment, identity. An engine declaring command, readyUrl, or services is INVALID_CONFIG at defineEngine; web() rejects them with a pointer at the target.
  • A target url on an engine that declares none is INVALID_CONFIG: explore and app.open() navigate whenever base is set, and a device engine cannot open an address. Metro for a debug build is probed with readyUrl; a release build has no command.
  • The config digest records the merged declaration once, so a URL on the engine or on the target digests alike, with command and service env values reduced to names either way (a run-level DATABASE_URL never enters the digest).
  • Foreign-key hints flip: webServer, a target-level url or command, point at app. The e2e init preset, testbed and web-benchmark configs, docs, and the skill follow.
targets: [
  { name: 'web', engine: web({ url: 'http://localhost:8081' }) },
  {
    name: 'ios',
    engine: mobile({ platform: 'ios', app: 'dev.example.app' }),
    app: {
      command: { executable: 'npx', args: ['expo', 'start'] },
      readyUrl: 'http://127.0.0.1:8081/status',
    },
  },
],
flowchart LR
  E[engine.app: url, identity, environment] --> M[merge: target over engine]
  T[target.app: + command, readyUrl, services] --> M
  M --> R[resolveTargetApp]
  R --> P[processes, ports]
  R --> C[cache and session identity]
  R --> D[config digest, env stripped]

Why: the engine was the only place config could carry a process, so web() grew command and mobile() had no way to start Metro at all, and a web plus native Expo suite had nowhere to put the one dev server both targets share. Cross-target service dedupe stays in this PR so a shared mock still starts once; it goes when config.services lands.


Devin Review