Skip to content

fix(desktop): resolve base.css from import.meta.url, not process.cwd() - #1969

Merged
h4yfans merged 1 commit into
mainfrom
fix-theme-tokens-test-cwd
Sep 2, 2026
Merged

fix(desktop): resolve base.css from import.meta.url, not process.cwd()#1969
h4yfans merged 1 commit into
mainfrom
fix-theme-tokens-test-cwd

Conversation

@h4yfans

@h4yfans h4yfans commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • theme-tokens.test.ts located base.css 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.
  • Fixed by resolving from import.meta.url instead, which jsdom gives a real file: URL regardless of invocation cwd.
  • Grepped process.cwd() under apps/desktop and 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 helper tests/utils/contrast.ts (outside src, so it wasn't in the issue's stated grep scope but hits the same bug). All fixed the same way.
  • Left the remaining process.cwd() hits alone: tailwind-arbitrary-css-vars.test.ts already falls back between both cwds, terminal-command.test.ts and paths.test.ts use cwd for synthetic/output paths rather than resolving a fixed source file, and check-cert-hashes.ts is a script that defaults an arg, not a test.

Test plan

  • pnpm exec vitest run --config config/vitest.config.ts --project renderer <paths> from apps/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 passed

Closes #1957

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
@github-actions github-actions Bot added bug Something isn't working test labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 4794b4a.

@h4yfans
h4yfans marked this pull request as ready for review September 2, 2026 18:01
@h4yfans
h4yfans merged commit e77990c into main Sep 2, 2026
16 checks passed
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DX]: theme-tokens.test.ts resolves base.css from process.cwd(), so it throws ENOENT when vitest runs from the repo root

1 participant