Skip to content

fix(test): add @vitejs/plugin-react to vitest config - #1

Merged
cheshirecode merged 2 commits into
mainfrom
fix/vitest-jsx-transform-and-arm64-bindings
Jun 6, 2026
Merged

cheshirecode merged 2 commits into
mainfrom
fix/vitest-jsx-transform-and-arm64-bindings

Conversation

@cheshirecode

@cheshirecode cheshirecode commented Jun 6, 2026 •

Copy link
Copy Markdown
Owner

What this PR fixes

Two small fixes that unblock npm run test:run:

  1. vitest.config.ts: added @vitejs/plugin-react plugin. Without it, JSX in .tsx test files failed to load (vite:import-analysis error). Result: 2 of 6 test files no longer parseable.

  2. package-lock.json regenerated: the previous lockfile was generated on a platform without arm64 awareness; @rolldown/binding-linux-arm64-{gnu,musl} were missing from the locked tree even though rolldown declared them in optionalDependencies. Regenerated on linux-arm64 inside an isolated sandbox.

Verification

  • npm run test:run → 6/6 test files pass, 43/43 tests pass (up from 4/6 files + 33 of the 43 tests passing, with 10 hidden behind unparseable JSX).
  • Verified inside cheshirecode/sandbox v1.1+ on linux-arm64.

Out-of-scope pre-existing bugs discovered (for maintainer to file separately)

While verifying this PR against the repo's own CI, three pre-existing bugs surfaced on main, unrelated to this fix:

  • .github/workflows/ci.yml matrix includes node-version: [18.x, 20.x] — Node 18.x cannot run vitest 4 / vite 8 / rolldown 1 (they use Node 22+ styleText API). [20.x, 22.x] recommended.
  • isomorphic-dompurify's nested jsdom is missing default-stylesheet.css — fails Next.js build on Node 22. Update dompurify or swap sanitizer.
  • test:e2e script missing — e2e.yml calls npm run test:e2e but package.json doesn't define it. playwright also not in devDependencies.

These are independent of this PR's scope (JSX transform + arm64 bindings). Recommend filing separately.

The vitest config had no plugins block, so .tsx files with JSX
syntax failed to parse (vite import-analysis transform). Adding
@vitejs/plugin-react gives Vitest the JSX/TSX transform it needs.

Before: 2 test files failed to load (ChatMessage.test.tsx,
useChat.test.tsx), 33 tests reported passed but 10 hidden behind
the unparseable transforms.

After: 6/6 test files pass, 43/43 tests pass.

Verified end-to-end inside cheshirecode/sandbox v1.1+:
  $ npm install --save-dev @vitejs/plugin-react
  $ npm run test:run
    Test Files  6 passed (6)
         Tests  43 passed (43)
cheshirecode added a commit to cheshirecode/sandbox that referenced this pull request Jun 6, 2026
Real bug found by dogfood: pushed a fix to cheshirecode/frontend-ai-template
from inside the sandbox; gh CLI was authenticated (hosts.yml written)
but git itself had no credential helper, so `git push` failed with
"could not read Username for 'https://github.com'".

Manual workaround was `gh auth setup-git` once per container, which
configures git's credential helper to invoke gh. Propagating into the
entrypoint so future runs work without manual setup.

The fix mirrors what `gh auth login --with-token` would have done if
we hadn't bypassed it for the scope-check reasons.

Evidence (D3 trailer):
  Before: `git push` from inside sandbox → "could not read Username"
  After:  `gh auth setup-git` runs automatically in entrypoint;
          git push works end-to-end.
  PR opened from inside sandbox using this exact flow:
  cheshirecode/frontend-ai-template#1

This was the LAST gap in the BYO-keys-free developer-loop promise.
Sandbox now supports: clone → install → test → commit → push → PR
end-to-end without any manual setup beyond `bin/sandbox.sh up`.
The lockfile was generated on a platform without arm64 awareness;
@rolldown/binding-linux-arm64-{gnu,musl} were missing from the locked
dependency tree even though rolldown declared them in optionalDependencies.

Regenerated from package.json on linux-arm64 inside cheshirecode/sandbox.
Lockfile now contains all platform-specific bindings. Tests still 43/43
pass; install on linux-arm64 hosts no longer needs the
`npm install --no-save @rolldown/binding-linux-arm64-gnu` workaround.
@cheshirecode
cheshirecode marked this pull request as ready for review June 6, 2026 02:29
@cheshirecode
cheshirecode force-pushed the fix/vitest-jsx-transform-and-arm64-bindings branch from b7a9cb3 to 758d3a7 Compare June 6, 2026 02:35
@cheshirecode
cheshirecode merged commit 80de8c8 into main Jun 6, 2026
0 of 6 checks passed
@cheshirecode
cheshirecode deleted the fix/vitest-jsx-transform-and-arm64-bindings branch June 6, 2026 02:44
cheshirecode added a commit to cheshirecode/sandbox that referenced this pull request Sep 16, 2026
Real bug found by dogfood: pushed a fix to cheshirecode/frontend-ai-template
from inside the sandbox; gh CLI was authenticated (hosts.yml written)
but git itself had no credential helper, so `git push` failed with
"could not read Username for 'https://github.com'".

Manual workaround was `gh auth setup-git` once per container, which
configures git's credential helper to invoke gh. Propagating into the
entrypoint so future runs work without manual setup.

The fix mirrors what `gh auth login --with-token` would have done if
we hadn't bypassed it for the scope-check reasons.

Evidence (D3 trailer):
  Before: `git push` from inside sandbox → "could not read Username"
  After:  `gh auth setup-git` runs automatically in entrypoint;
          git push works end-to-end.
  PR opened from inside sandbox using this exact flow:
  cheshirecode/frontend-ai-template#1

This was the LAST gap in the BYO-keys-free developer-loop promise.
Sandbox now supports: clone → install → test → commit → push → PR
end-to-end without any manual setup beyond `bin/sandbox.sh up`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant