test: gate demo and journey e2e specs behind moon typecheck - #859
Conversation
demo-next-e2e, demo-nuxt-e2e, and cli-journey-e2e had no typecheck task, so API/SDK contract drift in their Playwright specs only surfaced when someone ran the opt-in suites. Mirror the console-e2e gate (#858) in all three: a package.json typecheck script, a moon typecheck task with deps on the built workspace packages each program imports (@zitadel/testing for demo-next and cli-journey; demo-nuxt imports none), and tsconfig includes broadened so every config and spec file is inside the checked surface (demo-next's playwright.real.config.mts and src-real/ were previously invisible). The new gates immediately surfaced the flat-by-id drift (#810) in @zitadel/testing's seedUser — that fix landed on main in #858 (the identical hunk rebased away here) — and in demo-next's registration spec, whose response cast no longer converts from the generated ListUsers200; a plain destructure of the typed envelope replaces it. The demo tsconfigs also referenced sdk-next/api-mock without importing any of their types. Under plain tsc -p, those references redirect transitive @zitadel/api imports onto the packages' stale out-tsc declaration outputs, which made the gate check an eight-day-old client signature. Drop the references; workspace imports resolve to current source via the @zitadel/source condition, same as console-e2e. cli-journey-e2e's .mjs runner scripts leave the tsconfig include list: they import root workspace scripts (outside the composite project's rootDir), were never type-checked (checkJs off), and keep their runtime coverage through the node --test task.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
There was a problem hiding this comment.
Pull request overview
This PR adds CI-visible typechecking for the opt-in Playwright suites in demo-next-e2e, demo-nuxt-e2e, and cli-journey-e2e, so contract drift in their specs is caught in the standard :typecheck lane instead of only when someone runs the e2e suites manually.
Changes:
- Add
typecheckscripts (with localtypescriptdevDependency) and Moontypechecktasks for the three e2e projects. - Broaden tsconfig include globs to ensure Playwright configs and relevant spec directories are actually part of the typechecked surface, and remove tsconfig project references that could redirect workspace imports to stale
out-tscdeclarations. - Fix
demo-next-e2eregistration spec to rely on the typedlistUsersresponse shape instead of casting.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds typescript to relevant workspace importers to support new tsc-based typecheck scripts. |
| apps/demo-nuxt-e2e/tsconfig.json | Broadens includes and removes project references to avoid stale declaration redirects. |
| apps/demo-nuxt-e2e/package.json | Adds typecheck script and typescript devDependency. |
| apps/demo-nuxt-e2e/moon.yml | Introduces a Moon typecheck task for the Nuxt e2e project. |
| apps/demo-next-e2e/tsconfig.json | Broadens includes (including src-real) and removes project references. |
| apps/demo-next-e2e/src-real/registration.spec.ts | Removes an outdated response cast and uses the typed listUsers result. |
| apps/demo-next-e2e/package.json | Adds typecheck script and typescript devDependency. |
| apps/demo-next-e2e/moon.yml | Introduces a Moon typecheck task with the needed workspace build dependency. |
| apps/cli-journey-e2e/tsconfig.json | Adds DOM lib support and narrows the typechecked surface to TS specs/configs (excluding .mjs runner scripts). |
| apps/cli-journey-e2e/package.json | Adds typecheck script and typescript devDependency. |
| apps/cli-journey-e2e/moon.yml | Introduces a Moon typecheck task with the needed workspace build dependency. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Review finding (codex, P2): fixtures/testkit/zitadel-e2e/*.spec.ts pin the customer-facing @zitadel/testing/playwright contract but were only exercised through the opt-in e2e-testkit task — a type error inserted there passed the new gate. Add fixtures/testkit/**/*.ts to the checked surface; the fixtures/preexisting/ family stays out because its framework globals (defineNuxtConfig) only exist inside the generated app.
Review finding (codex, P2, round two): the testkit fixture's Playwright config imported withZitadel/nextAppEnv as an unchecked .mjs — a nonexistent export passed the gate, and including the file would not have helped with checkJs off. Convert it to .mts so the *.mts include picks it up fully checked: the kit README documents a TypeScript config (playwright.config.ts) and the suite's specs are already .ts, so this moves the fixture closer to the documented consumer posture, not away. The journey copies fixtures/testkit recursively; the only filename reference is run-local.mjs's --config invocation, updated. Verified: tsc --listFilesOnly shows the config in the program; a broken kit import now fails the gate (TS2724); playwright test --list loads and evaluates the .mts config and enumerates both consumer tests. The full runtime lane runs in CI — journey_testkit gates on the journey project, which this PR touches.
Summary
demo-next-e2e,demo-nuxt-e2e, andcli-journey-e2ehad notypechecktask, so API/SDK contract drift in their Playwright specs only surfaced when someone ran the opt-in suites. This mirrors fix(console): follow the flat-by-id management API contract #858's console-e2e gate in all three: a package.jsontypecheckscript +typescript: "catalog:"devDep, a moontypechecktask with deps on the built workspace packages each program actually imports (testing:buildfor demo-next and cli-journey; demo-nuxt imports none), and tsconfig includes broadened so every config and spec file is inside the checked surface — demo-next'splaywright.real.config.mtsand the entiresrc-real/directory were previously invisible to any type checker.@zitadel/testingseedUserfix landed on main in fix(console): follow the flat-by-id management API contract #858 (the identical hunk rebased away here), and demo-next's registration spec carried a response cast that no longer converts from the generatedListUsers200— replaced by a plain destructure of the typed envelope.references(sdk-next/api-mock) from the demo projects: nothing there imports their types, and under plaintsc -pthose references redirect transitive@zitadel/apiimports onto the packages' staleout-tsc/declaration outputs — the gate was checking an eight-day-old client signature (phantom 3-arg camelCasesetUserPassword). Workspace imports now resolve to current source via the@zitadel/sourcecondition, same as console-e2e..mjsrunner scripts leave the tsconfig include list: they import root workspace scripts (outside the composite project's rootDir), were never type-checked (checkJsoff), and keep their runtime coverage through thenode --testtask.Validation
moon run demo-next-e2e:typecheck demo-nuxt-e2e:typecheck cli-journey-e2e:typecheck— green (re-run after rebasing onto fix(console): follow the flat-by-id management API contract #858)moon run testing:typecheck testing:test demo-next-e2e:lint demo-nuxt-e2e:lint cli-journey-e2e:lint— green (4 lint warnings pre-existing on untouched lines)node scripts/check-pr-title.mjs --title "test: gate demo and journey e2e specs behind moon typecheck"— okRelease notes / changeset
@zitadel/testingdrift fix shipped separately in fix(console): follow the flat-by-id management API contract #858.Notes
referencescombined with the@zitadel/sourcecustom condition make plaintsc -p(not--build) resolve transitive workspace imports to the referenced closure'sout-tsc/declarations, which nothing in these projects keeps fresh. References here must reflect actual type-level imports (console-e2e precedent: none).runInCI: false); only their type surface joins CI, via the standard:typechecklane and ci: gate full-mode tail steps on moon affected-task selection #731's affected gating.