Headless requires vite — declare an (optional) peer and/or own it via a @srhazi/gooey-test/vite plugin #2

Closed
opened 2026-10-12 02:13:43 +00:00 by orchestrator · 0 comments
Member

Headless mode currently requires the consumer to have vite installed (the runner starts the consumer's Vite so their config/plugins apply), but vite is not declared anywhere — so it's easy to miss and the run fails with spawn vite ENOENT.

Options:

  1. Optional peerDependency vite (documented) — npm 7+/pnpm auto-install it; yarn-classic still needs an explicit install. Imposes Vite on browser-only consumers only as a peer.
  2. Regular dependency — always present, but pins/duplicates Vite (and the runner would still prefer the consumer's hoisted copy so their config applies). Two Vite versions is a footgun.
  3. Keep it documented only (status quo).

Recommendation: don't hard-depend on Vite — we want the consumer's Vite/config. Declare it as an optional peer, and let the real fix be a @srhazi/gooey-test/vite plugin that owns the integration: serve the runner entry at a stable path and discover test files via a virtual module (import.meta.glob), so hosted-browser and headless modes "just work" without hand-wiring Vite or a #/a.test.ts:b.test.ts URL. That plugin can also provide sane Vite defaults/fallback.

Related: PR #1 (headless runner), review comment 129.


Related: PR #1 review comment #129 (the lead's question) and the proposal in #146.

Headless mode currently requires the **consumer** to have `vite` installed (the runner starts the consumer's Vite so their config/plugins apply), but `vite` is not declared anywhere — so it's easy to miss and the run fails with `spawn vite ENOENT`. Options: 1. **Optional `peerDependency` `vite`** (documented) — npm 7+/pnpm auto-install it; yarn-classic still needs an explicit install. Imposes Vite on browser-only consumers only as a peer. 2. **Regular `dependency`** — always present, but pins/duplicates Vite (and the runner would still prefer the consumer's hoisted copy so their config applies). Two Vite versions is a footgun. 3. **Keep it documented only** (status quo). Recommendation: don't hard-depend on Vite — we *want* the consumer's Vite/config. Declare it as an optional peer, and let the real fix be a **`@srhazi/gooey-test/vite` plugin** that owns the integration: serve the runner entry at a stable path and discover test files via a virtual module (`import.meta.glob`), so hosted-browser and headless modes "just work" without hand-wiring Vite or a `#/a.test.ts:b.test.ts` URL. That plugin can also provide sane Vite defaults/fallback. Related: PR #1 (headless runner), review comment 129. --- **Related:** PR #1 review comment [#129](https://git.abstract.properties/legend/gooey-test/pulls/1#issuecomment-129) (the lead's question) and the proposal in [#146](https://git.abstract.properties/legend/gooey-test/pulls/1#issuecomment-146).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
legend/gooey-test#2
No description provided.