test(e2e): isolate build/ rstest spawns to per-fixture cwd#1247
Merged
Conversation
Sibling test files in e2e/build/ used to spawn rstest with cwd=__dirname, sharing the default output path. When any of them triggered disk writes (buildCache fixtures, DEBUG=rstest), they raced against assertions in build/index.test.ts on dist/.rstest-temp/. Move every spawn to its own fixture subdirectory so each invocation owns its dist tree. Drop now- redundant include/buildDependencies entries that anchored to the parent cwd, and document the convention in the testing skill.
Rsdoctor Bundle Diff AnalysisFound 12 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
The previous wording read as an absolute "never share cwd: __dirname", but in practice the race only manifests when something forces disk writes (buildCache, coverage, DEBUG=rstest, writeToDisk). Most e2e tests share cwd: __dirname for pure in-memory runs and that's fine. Reframe the section so the rule only applies to the disk-writing case and the in-memory shared-cwd pattern is acknowledged as the norm.
The previous wording listed any disk write (buildCache, writeToDisk, DEBUG, coverage) as a trigger, but coverage and blob reporters write to different paths (coverage/, .rstest-reports/) and aren't on the dist/.rstest-temp/ race surface. Narrow the rule to the actual trigger — fixtures that persist the built bundle via buildCache or writeToDisk — so existing coverage e2e patterns no longer read as violations.
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.
Summary
Background
e2e/build/buildCache.test.tsande2e/build/index.test.tsboth spawned rstest subprocesses withcwd: __dirname. When any sibling test triggered disk writes —performance.buildCache(enabled by the three buildCache fixtures),DEBUG=rstest, etc. — they raced on the shared default output pathe2e/build/dist/.rstest-temp/, intermittently flipping theshould write output to customized distPath.rootassertion inbuild/index.test.ts. CI hid this viaretry: 2+ low CPU concurrency; locally it failed ~85% of the time.Implementation
runRstestClispawn undere2e/build/into the fixture's own subdirectory ascwd, so each invocation owns itsdist/.rstest-temp/tree.include/buildDependenciesentries frombuildCacheandhappyDomBuildCachefixture configs that anchored to the outer cwd; rstest auto-discovers the fixture'sindex.test.tsoncecwdis the fixture itself..agents/skills/testing/SKILL.mdso future tests don't reintroduce the pattern.User Impact
None — internal e2e test refactor.
Related Links
N/A
Checklist
Validation