Repository navigation
perf(cli): load the YAML and TOML parsers only when e2e init needs them - #1861
Conversation
The CLI adds the init flags at every start, and flags.ts read the --ci and --mcp choices from ci.ts and mcp-config.ts, which statically import `yaml` and `toml-eslint-parser`. Every command, `e2e run` and `e2e mcp` included, loaded both parsers. The choice lists now live in init/choices.ts, which imports nothing, so the parsers load only when `e2e init` runs. The startup table in package-imports.test.ts now lists both packages as lazy for cli/index.ts, and init-ci.test.ts checks that CI_SERVICES has one service per --ci choice, in the same order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🟢 e2e web: 93 passedAll 93 tests in 42 files
Tested by e2e 0.23.1 · 57.7s · web · run artifacts |
🟢 e2e web agent: 34 passed35 agent steps · 26 replayed from cache · 26 model calls · 128.6k tokens (92% cached) · $0.0060 All 34 tests in 5 files
Tested by e2e 0.23.1 · 1m 45s · web · run artifacts |
🟢 e2e android agent: 20 passed24 agent steps · 15 replayed from cache · 52 model calls · 346.1k tokens (83% cached) · $0.0225 All 20 tests in 1 file
Tested by e2e 0.23.1 · 6m 27s · android-emulator · run artifacts |
🟢 e2e ios: 56 passed, 1 skippedAll 57 tests in 7 files
Tested by e2e 0.23.1 · 6m 46s · ios-simulator · run artifacts |
🟢 e2e ios agent: 1 flaky, 20 passed, 1 skipped25 agent steps · 12 replayed from cache · 58 model calls · 417.5k tokens (83% cached) · $0.0285
|
| Test | Agent | Time | |
|---|---|---|---|
| tests-agent/scenarios.e2e.ts · 1 flaky, 20 passed, 1 skipped | 25 steps · 58 calls | 7m 58s | |
| 🟢 | act completes Login Form | 1 step | 39.8s |
| 🟢 | act completes Infinite Scroll List | 1 step | 34.2s |
| 🟢 | act completes Modal Flow | 1 step | 9.8s |
| 🟢 | act completes Bottom Tabs | 1 step | 7.2s |
| 🟢 | act completes Text Input Variations | 1 step | 12.3s |
| 🟢 | act completes Broken Accessibility | 2 steps · 6 calls | 24.1s |
| 🟢 | act completes Vision Only | 2 steps · 6 calls | 26.3s |
| act completes Gestures (1 failed attempt first) | 1 step · 11 calls | 40.9s | |
| 🟢 | act completes Async States | 1 step · 8 calls | 21.8s |
| 🟢 | act completes Debounced Search | 1 step · 1 call | 26.4s |
| 🟢 | act completes Flattened Registration Form | 2 steps · 1 call | 25.2s |
| 🟢 | act completes Flattened Login | 2 steps · 11 calls | 56.6s |
| 🟢 | act completes Sticky Chrome Target | 1 step | 12.8s |
| 🟢 | act completes WebView Accessibility | 1 step | 11.7s |
| 🟢 | act completes Permission Prompt | 1 step | 10.8s |
| 🟢 | act completes Photo Picker | 1 step · 2 calls | 28.2s |
| 🟢 | act completes Product Catalog | 1 step | 10.1s |
| 🟢 | act completes Error Recovery | 1 step | 10.2s |
| 🟢 | act completes Choice Controls | 1 step · 4 calls | 30.5s |
| 🟢 | act completes Stripe PaymentSheet | 1 step · 8 calls | 29.2s |
| 🟢 | act completes Apple Pay | 1 step | 10.5s |
| ⏭️ | act completes Apple Pay Billing Address (skipped: the CI simulator's Apple Pay sheet skips the billing-address step, so the scenario cannot be completed there) |
Tested by e2e 0.23.1 · 8m 44s · ios-simulator · run artifacts
🟢 e2e android: 58 passed, 1 skippedAll 59 tests in 7 files
Tested by e2e 0.23.1 · 9m 45s · android-emulator · run artifacts |
What and why
cli/index.tsstatically importedcli/init/flags.tsfor thee2e initoptions. Through it, every CLI start (e2e run,e2e mcp,e2e --version) loaded two parsers onlye2e inituses:flags.ts > ci.ts > yaml(since feat(cli): write a GitHub Actions or GitLab CI/CD pipeline in e2e init #1647)flags.ts > mcp-config.ts > codex-config.ts > toml-eslint-parserCI_IDS,MCP_LOCATIONS, and their types) move topackages/e2e/src/cli/init/choices.ts, which imports nothing.ci.tskeepsCI_SERVICES, whose entries hold the YAML render functions. Both parsers now load only whene2e initruns.e2e init --helplists the same--ciand--mcpchoices as before.tests/unit/package-imports.test.tsaddsyamlandtoml-eslint-parserto the modulescli/index.tsmust reach only lazily; on main it fails and prints both chains.init-ci.test.tschecks thatCI_SERVICEShas one service per--cichoice, in order, now that the two lists live in separate files.Verified
Ran it locally: yes
Built CLI,
node packages/e2e/dist/cli/bin.js --version, 40 runs per build in random order, load 2.9 (Apple M3 Max, Node 24.20.0):e2e initwith--ci github-actionsand--ci gitlabstill writes the same pipelines (thecli-initunit and integration tests), and the testbed suite passes on the built packages.🤖 Generated with Claude Code