fix: build package before running its own e2e tests#167
Merged
Conversation
The test:e2e and test:e2e:dev turbo tasks only depended on ^build (upstream packages), so @funstack/static#build could run concurrently with @funstack/static#test:e2e. When the build was not already in the turbo cache (as in the e2e-vite7 CI job, which builds via pnpm --filter and bypasses turbo), tsdown cleaned dist/ while the Playwright webServer was resolving @funstack/static, failing with 'Failed to resolve entry for package'. Depending on the package's own build task removes the race. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JZUuLgc4ndfHC8GT7JWDv2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
e2e-vite7CI job on master failed intermittently (example run) with:Root cause
In
turbo.json,test:e2e/test:e2e:devonly declareddependsOn: ["^build"], which covers upstream packages' builds but not the package's own build. Turbo therefore runs@funstack/static#buildand@funstack/static#test:e2econcurrently, and tsdown cleansdist/while the Playwright webServer is resolving@funstack/static(the e2e fixtures import fromdist/via package exports).The regular
cijob dodges this because its earlierpnpm run buildstep primes the Turbo cache, making the build task an instant replay duringtest:e2e. Thee2e-vite7job builds withpnpm --filter @funstack/static build, which bypasses Turbo's cache, soturbo run test:e2ere-executes the real build in parallel with the tests — a timing-dependent race.Fix
Add the package's own
buildtask todependsOnfortest:e2eandtest:e2e:dev, so the build is always ordered before the e2e tests. Verified withturbo run test:e2e --dry=jsonthat@funstack/static#test:e2enow depends on@funstack/static#build.🤖 Generated with Claude Code
https://claude.ai/code/session_01JZUuLgc4ndfHC8GT7JWDv2
Generated by Claude Code