fix(desktop): resolve base.css from import.meta.url, not process.cwd() - #1969
Merged
Conversation
theme-tokens.test.ts and five sibling tests/helpers located base.css (and package.json) relative to process.cwd(), which is apps/desktop when vitest runs there but the repo root when invoked with an explicit --config path from the root — the documented way to run a targeted test in a fresh worktree. That threw ENOENT for a reason unrelated to the test's subject. Resolve from import.meta.url instead, which jsdom gives a real file: URL regardless of invocation cwd. Closes #1957
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
h4yfans
marked this pull request as ready for review
September 2, 2026 18:01
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
theme-tokens.test.tslocatedbase.cssrelative toprocess.cwd(), which isapps/desktopwhen vitest runs there but the repo root when invoked with an explicit--configpath from the root — the documented way to run a targeted test in a fresh worktree. That threw ENOENT for a reason unrelated to the test's subject.import.meta.urlinstead, which jsdom gives a realfile:URL regardless of invocation cwd.process.cwd()underapps/desktopand found the same cwd-dependent file-resolution bug in five more places:blocknote-text-color-css.test.ts,excalidraw-context-menu-css.test.ts,mind-map-library-contract.test.ts,review-ui.test.tsx, and the shared helpertests/utils/contrast.ts(outsidesrc, so it wasn't in the issue's stated grep scope but hits the same bug). All fixed the same way.process.cwd()hits alone:tailwind-arbitrary-css-vars.test.tsalready falls back between both cwds,terminal-command.test.tsandpaths.test.tsuse cwd for synthetic/output paths rather than resolving a fixed source file, andcheck-cert-hashes.tsis a script that defaults an arg, not a test.Test plan
pnpm exec vitest run --config config/vitest.config.ts --project renderer <paths>fromapps/desktop— 5 files, 81 tests passed./node_modules/.bin/vitest run --config apps/desktop/config/vitest.config.ts --project renderer <paths>from the repo root — 5 files, 81 tests passedCloses #1957