chore(test): pin fixture deps and manifest-drive the e2e harness#280
Conversation
🦋 Changeset detectedLatest commit: d4a7d82 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Stack: wyattjoh/nextjs-pinned-range Part of a stacked-prs chain. Do not merge manually. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a fixture-dependency utility module (scripts/lib/fixture-deps.ts) and tests, and integrates it into the refresh-e2e-fixtures script to apply package.json overrides, resolve dependency specs to exact versions, and validate pinned ranges. Migrates test log-capture from an AsyncLocalStorage-based API to a hook-style useCaptureLog() and replaces with a module-level active capture plus new log.ui() method; updates many tests, test stubs, and integration harnesses to use the new API. Updates spinner/logging to emit via log.ui(), refactors e2e fixture setup to createGetFixture()/Bun describe blocks and npx scaffolding, and pins numerous fixture package.json versions. Removes scripts/run-tests.ts. Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes |
3e50dc0 to
1514c5e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/e2e/users-list.test.ts`:
- Around line 48-52: The test switched to awaiting Promise.all for
createTestUser but never populates createdIds, so afterAll cleanup doesn't
delete the created users; modify the code that calls createTestUser (the
Promise.all(...) result assigned to users) to extract and push each returned
user id into the existing createdIds array (or replace createdIds with
users.map(u => u.id)), ensuring the afterAll teardown logic that iterates
createdIds will actually delete the created users; reference the createTestUser
call site and the createdIds variable and the afterAll cleanup to make the
change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d63bd112-853f-4241-b00b-b8d1bcbd7f7a
⛔ Files ignored due to path filters (9)
test/e2e/fixtures/astro/package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/fixtures/nextjs-app-router-next14/package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/fixtures/nextjs-app-router/package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/fixtures/nextjs-pages-router/package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/fixtures/nuxt/package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/fixtures/react-router/package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/fixtures/react/package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/fixtures/tanstack-start/package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/fixtures/vue/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (86)
.claude/rules/e2e.md.claude/rules/logging.md.oxfmtrc.json.oxlintrc.jsonCONTRIBUTING.mdpackage.jsonpackages/cli-core/package.jsonpackages/cli-core/src/cli-program.tspackages/cli-core/src/commands/api/catalog.test.tspackages/cli-core/src/commands/api/index.test.tspackages/cli-core/src/commands/api/interactive.test.tspackages/cli-core/src/commands/api/ls.test.tspackages/cli-core/src/commands/apps/create.test.tspackages/cli-core/src/commands/apps/list.test.tspackages/cli-core/src/commands/auth/login.test.tspackages/cli-core/src/commands/auth/logout.test.tspackages/cli-core/src/commands/billing/index.test.tspackages/cli-core/src/commands/config/pull.test.tspackages/cli-core/src/commands/config/push.test.tspackages/cli-core/src/commands/config/schema.test.tspackages/cli-core/src/commands/deploy/index.test.tspackages/cli-core/src/commands/doctor/context.test.tspackages/cli-core/src/commands/env/pull.test.tspackages/cli-core/src/commands/init/index.test.tspackages/cli-core/src/commands/init/scan.test.tspackages/cli-core/src/commands/link/index.test.tspackages/cli-core/src/commands/open/index.test.tspackages/cli-core/src/commands/orgs/index.test.tspackages/cli-core/src/commands/switch-env/index.test.tspackages/cli-core/src/commands/unlink/index.test.tspackages/cli-core/src/commands/users/create.test.tspackages/cli-core/src/commands/users/list.test.tspackages/cli-core/src/commands/users/menu.test.tspackages/cli-core/src/commands/users/open.test.tspackages/cli-core/src/commands/whoami/index.test.tspackages/cli-core/src/lib/auth-server.test.tspackages/cli-core/src/lib/autoclaim.test.tspackages/cli-core/src/lib/autolink.test.tspackages/cli-core/src/lib/bapi-command.test.tspackages/cli-core/src/lib/first-application.test.tspackages/cli-core/src/lib/keyless.test.tspackages/cli-core/src/lib/log.test.tspackages/cli-core/src/lib/log.tspackages/cli-core/src/lib/spinner.tspackages/cli-core/src/test/integration/lib/harness.tspackages/cli-core/src/test/lib/stubs.tsscripts/lib/fixture-deps.test.tsscripts/lib/fixture-deps.tsscripts/refresh-e2e-fixtures.tsscripts/run-tests.tstest/e2e/astro.test.tstest/e2e/fixtures/astro/README.mdtest/e2e/fixtures/astro/package.jsontest/e2e/fixtures/nextjs-app-router-next14/package.jsontest/e2e/fixtures/nextjs-app-router/package.jsontest/e2e/fixtures/nextjs-pages-router/package.jsontest/e2e/fixtures/nuxt/package.jsontest/e2e/fixtures/react-router/app/routes/home.tsxtest/e2e/fixtures/react-router/package.jsontest/e2e/fixtures/react-router/tsconfig.jsontest/e2e/fixtures/react-router/vite.config.tstest/e2e/fixtures/react/index.htmltest/e2e/fixtures/react/package.jsontest/e2e/fixtures/tanstack-start/AGENTS.mdtest/e2e/fixtures/tanstack-start/README.mdtest/e2e/fixtures/tanstack-start/package.jsontest/e2e/fixtures/vue/index.htmltest/e2e/fixtures/vue/package.jsontest/e2e/fixtures/vue/src/App.vuetest/e2e/fixtures/vue/src/components/HelloWorld.vuetest/e2e/lib/dev-server.tstest/e2e/lib/fixture-setup.tstest/e2e/lib/fixture-test.tstest/e2e/lib/logger.tstest/e2e/lib/test-user.tstest/e2e/lib/types.tstest/e2e/nextjs-app-router-next14.test.tstest/e2e/nextjs-app-router.test.tstest/e2e/nextjs-pages-router.test.tstest/e2e/nuxt.test.tstest/e2e/react-router.test.tstest/e2e/react.test.tstest/e2e/tanstack-start.test.tstest/e2e/tsconfig.jsontest/e2e/users-list.test.tstest/e2e/vue.test.ts
💤 Files with no reviewable changes (4)
- test/e2e/fixtures/react-router/app/routes/home.tsx
- scripts/run-tests.ts
- test/e2e/fixtures/react-router/tsconfig.json
- test/e2e/fixtures/tanstack-start/AGENTS.md
✅ Files skipped from review due to trivial changes (18)
- .oxfmtrc.json
- test/e2e/fixtures/nuxt/package.json
- test/e2e/fixtures/nextjs-pages-router/package.json
- test/e2e/fixtures/astro/package.json
- CONTRIBUTING.md
- test/e2e/fixtures/vue/src/components/HelloWorld.vue
- packages/cli-core/src/commands/users/menu.test.ts
- packages/cli-core/src/commands/doctor/context.test.ts
- test/e2e/fixtures/vue/src/App.vue
- test/e2e/fixtures/vue/index.html
- test/e2e/fixtures/tanstack-start/README.md
- packages/cli-core/src/cli-program.ts
- packages/cli-core/package.json
- test/e2e/fixtures/react/index.html
- test/e2e/fixtures/nextjs-app-router-next14/package.json
- .oxlintrc.json
- packages/cli-core/src/lib/auth-server.test.ts
- test/e2e/fixtures/astro/README.md
🚧 Files skipped from review as they are similar to previous changes (7)
- test/e2e/fixtures/nextjs-app-router/package.json
- test/e2e/fixtures/react-router/package.json
- scripts/lib/fixture-deps.test.ts
- test/e2e/lib/types.ts
- scripts/lib/fixture-deps.ts
- scripts/refresh-e2e-fixtures.ts
- test/e2e/fixtures/vue/package.json
88c14ab to
2ca4be0
Compare
2ca4be0 to
5e0198f
Compare
5e0198f to
7750d4a
Compare
…ture lifecycle
Pin every E2E fixture project's dependencies and check in package-lock.json
files so fixture installs are reproducible and skip scaffolding the upstream
templates from scratch on each run. Switch fixtures from bun-based installs
to npm to match what users would do on a freshly scaffolded app.
Replace the useFixture helper with createGetFixture, returning
{ fixture, users } so each test owns its own user lifecycle and tracks
created users for explicit cleanup. Add scripts/lib/fixture-deps for the
shared pinning logic plus tests.
Migrate test infrastructure off scripts/run-tests.ts to native
bun test --parallel for both unit and E2E pipelines, and fold test/e2e
into the lint, format, and typecheck commands.
Each fixture test file calls `describe()` at the top level, so the refresh
script could no longer load them outside `bun test`. Move every fixture's
config into `test/e2e/fixtures.manifest.ts` keyed by fixture name, and
have `createFixtureHarness(name)` look up the config plus fixtureDir from
the manifest, embedding both on the returned `Fixture`. The refresh
script imports the manifest directly, dropping all test-file imports and
the `CLERK_REFRESH_FIXTURES` env-var shim.
Each fixture test file shrinks to a typed `createFixtureHarness("<name>")`
call, and the helpers (`runFixtureTests`, `runFileExistsTest`,
`runBrowserTests`) read config from the harness handle instead of
threading it through every call.
`oxfmt`/`oxlint` exit with an error when every staged file is ignored by the formatter/linter config, which breaks commits that only touch `test/e2e/fixtures/**`. Pass `--no-error-on-unmatched-pattern` to both so fixture-only commits no longer fail the pre-commit hook.
Inline CLERK_PLATFORM_API_KEY plumbing per CLI invocation instead of a shared helper, validate publishable/secret keys with regex expectations, and force color in the op-wrapped subprocess for readable output.
710f7b0 to
8881d1d
Compare
Regenerates every fixture via `bun run e2e:refresh-fixtures` to pick up upstream template/dependency drift since the harness overhaul landed.
…ange lookup - scripts/lib/fixture-deps.ts: parallelize per-field resolveVersion calls via Promise.all - scripts/lib/fixture-deps.ts: replace nested ternary in validatePinnedDependencyRanges with Array.find
EFAULT from node:fs/promises rm in afterAll was failing the Nuxt fixture even though the test itself passed (oven-sh/bun#28958 and #9298 surface EFAULT in place of the real errno). Wrap fixture-setup cleanup in a best-effort safeRm that logs and continues; the OS reclaims /tmp anyway.
Summary
Reproducibility, harness ergonomics, and a pre-commit-hook fix for the e2e suite.
The e2e fixture tooling moves from
bunx/bun installontonpx/npm ciwith a committedpackage-lock.jsonin each fixture, and every non-Clerk dependency is resolved to an exact version throughnpm viewat refresh time so scaffolded projects no longer drift between runs. Scaffolders that change behavior across majors are pinned through an explicitpinnedDependencyRangesconfig, replacing the olderpinned: boolean+--forceflag, and a TanStack peer-dependency mismatch is now expressed declaratively viapackageJsonOverrides. The resolution, override, and validation logic lives in a newscripts/lib/fixture-deps.tsmodule covered by its own unit tests.The e2e harness consolidates around a single
createFixtureHarness(name)entry point. Every fixture's config moves intotest/e2e/fixtures.manifest.tskeyed by fixture name, so the refresh script can import the manifest directly and no longer needs to load test files or theCLERK_REFRESH_FIXTURESenv-var shim. The harness handle carries the fixture config and directory, exposes a per-test users API that auto-cleans created users inafterEach, and givesrunFixtureTests/runFileExistsTest/runBrowserTestsa single place to read config from. A dedicatedtest/e2e/tsconfig.jsonbrings the e2e tree underbun run typecheck, and e2e logging is silenced unlessCLERK_E2E_DEBUG=1.The custom
scripts/run-tests.tswrapper is dropped in favor of runningbun test --paralleldirectly, which implies--isolateand gives module-state isolation between test files for free. Lint and format coverage extend overtest/e2e/, with an.oxfmtrc.jsonthat excludes fixture lockfiles and a no-console oxlint override scoped to the e2e tree where the logger is a deliberate console wrapper.Test plan
bun run format:checkbun run lintbun run typecheckbun run testbun run test:e2e:op