Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Check for `@testing-library/jest-dom` doesn't guarantee it's safe to use as `setupFiles` in Vitest

Aperta
#231 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
testing

Direzione di ricerca

Start with src/index.ts around lines 182-191, then run the pnpm minimal reproduction with Vitest described in the issue. Compare behavior with and without the transitive storybook dependency, and verify that the empty Solid/Vitest project still runs when the package is not a direct dependency.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

This check doesn't guarantee that passing '@testing-library/jest-dom/vitest' as setupFiles to Vitest is safe.

The current check:

https://github.com/solidjs/vite-plugin-solid/blob/904b25b6b846a20549281e576947cf5fbb5d55ba/src/index.ts#L182-L191

only verifies that eslint-plugin-solid itself can resolve @testing-library/jest-dom/vitest.
It does not guarantee that Vitest can safely use it as a setupFiles entry.


Problem

In my project (using pnpm), I hit a false positive:

  • storybook depends directly on @testing-library/jest-dom.
  • storybook-solidjs-vite depends on vite-plugin-solid
  • vite-plugin-solid lists @testing-library/jest-dom as an optional peer dependency.
  • Because of pnpm’s virtual store, both end up colocated such that require.resolve("@testing-library/jest-dom/vitest") from vite-plugin-solid succeeds.

However, my project itself doesn’t depend on @testing-library/jest-dom, since I only use Vitest with vite-plugin-solid for reactivity tests (no DOM tests).

When Vitest parses the config, it can resolve vite-plugin-solid, but it cannot resolve the automatically added @testing-library/jest-dom/vitest import. This breaks the setup.


Minimal Reproduction
  1. Create an empty project
pnpm init
pnpm add -D vitest vite vite-plugin-solid
  1. Add a vitest.config.js with
export default defineConfig({
  plugins: [solid()],
  test: {
    environment: "node",
  },
});

And a simple test file (it should run).

  1. Reinstall dependencies, this time with a transitive dependency on @testing-library/jest-dom:
pnpm add -D storybook storybook-solidjs-vite
  1. Run the test, it should now fail with "Failed to load url .../@testing-library/jest-dom/vitest".
Lingua principale
TypeScript
Stelle
520
Fork
70
Merge medio
23h 35m
PR unite (30g)
39

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di solidjs/solid-vite-plugin

Tutte le issue di solidjs/solid-vite-plugin

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.