Repository navigation
test: sandbox the data dir when tests run from a package directory - #1626
Merged
Merged
Conversation
Bun reads only the bunfig.toml in the directory bun test runs from, so a run from apps/pi-extension or packages/server skipped the root preloads and wrote history, feedback and submission records into the real ~/.plannotator. Mirror the root [test] preloads in every apps/* and packages/* directory that has tests, guarded by tests/package-bunfig.test.ts. Also stop storage.test.ts creating ~/.plannotator/test-plans in the real home.
YeKc1M
pushed a commit
to YeKc1M/plannotator
that referenced
this pull request
Oct 1, 2026
…acknotprop#1626) Bun reads only the bunfig.toml in the directory bun test runs from, so a run from apps/pi-extension or packages/server skipped the root preloads and wrote history, feedback and submission records into the real ~/.plannotator. Mirror the root [test] preloads in every apps/* and packages/* directory that has tests, guarded by tests/package-bunfig.test.ts. Also stop storage.test.ts creating ~/.plannotator/test-plans in the real home.
1 task
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.
Follow-up to #1624.
Problem
Bun reads only the
bunfig.tomlin the directorybun testruns from. The rootbunfig.tomlpreloadstests/setup/feedback-archive-off.ts(tempPLANNOTATOR_DATA_DIR, feedback archive off), but a run from a package directory (cd apps/pi-extension && bun test,cd packages/server && bun test) skipped it and wrote into the contributor's real~/.plannotator, against the CLAUDE.md Testing Rules.Fix
bunfig.tomlin everyapps/*/packages/*directory that contains tests (17), with only a[test]section that mirrors the root preloads via../../paths. The setup logic is not duplicated. The happy-dom preload is opt-in (DOM_TESTS=1), so including it changes nothing for a plain run.tests/package-bunfig.test.tsfails when a package gains tests without a bunfig, or when a package bunfig's preloads drift from the root list.packages/server/storage.test.ts: the tilde test created~/.plannotator/test-plansin the real home on every run, including root runs, becausegetPlanDirmkdirs its result andos.homedir()ignores aHOMEoverride. It now expands bare~, which already exists.CI is unchanged: every workflow runs
bun testfrom the repo root, which still reads only the root bunfig.Evidence
Fake
HOME(temp dir),PLANNOTATOR_DATA_DIR/XDG_DATA_HOME/PLANNOTATOR_FEEDBACK_HISTORYunset,bun testfrom the package directory.$HOME/.plannotatorapps/pi-extensionbeforefeedback/pi-annotate-submission-test-*/index.jsonl+records/*,history/_unknown/annotate-doc-md-*/001.mdapps/pi-extensionafterpackages/serverbeforehistory/test-project/*,history/_unknown/annotate-*(incl.submissions/),history/pkg-sandbox/test-plan-*,feedback/_unknown/records/*, plus emptytest-plans/packages/serverafterRoot
bun test: before 5397 pass / 1244 skip / 0 fail (6641 tests), after 5415 pass / 1244 skip / 0 fail (6659; +18 from the new guard test).apps/guides-showandapps/vscode-extensionbun run testpass.bun run typecheckpasses.