vite: run vitest tests inside env-runner runtimes (miniflare, ...)
Los mantenedores suelen responder en 2 días
@pi0x ya está trabajando en esto.
Desde el 8/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Follow-up to #4748. Vitest tests in a project using the nitro() Vite plugin always run in Vitest's Node.js workers, and the devServer.runner option (and presets that set it, like miniflare for Cloudflare) is ignored. Code that needs the real platform, such as cloudflare:workers imports or bindings, can't be tested.
Proposal
Run test files inside the env-runner runtime (miniflare, Bun, Deno, ...), similar to how @cloudflare/vitest-pool-workers works for Cloudflare.
- Host side: a custom Vitest pool. Vitest 5's pool API (
createPoolWorker()returning a worker withstart/stop/send/on) would start an env-runner runner and forward Vitest's worker messages to it. - Runtime side: a worker entry that wires env-runner's message channel to the experimental
init({ post, on, runTests, collectTests })fromvitest/worker. - Main challenge: the Vitest worker runtime imports
node:vm,node:async_hooksand chai, writes snapshots, and evaluates modules withnew AsyncFunction, which workerd does not allow without miniflare's unsafe-eval binding. env-runner already has a workerd-safe evaluator for the dev worker, but the Vitest runner, mocker and snapshot code would need shims or replacements per runtime. A first spike should check whethervitest/workercan run in workerd at all.
Fallback
If this turns out to be very complex, a smaller alternative: keep test files in Node.js, but route serverFetch to the app running in the real env-runner dev worker (started from configureVitest via the existing initEnvRunner(), URL passed to tests with project.provide()). Requests then run in the real runtime with its bindings, while direct runtime calls in tests and vi.mock stay in Node.js, so it suits integration tests rather than unit tests.
Opened with AI assistance.
- Lenguaje dominante
- TypeScript
- Estrellas
- 11.5k
- Forks
- 968
- Merge medio
- 4 d 9 h
- PR fusionados (30 d)
- 64
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nitrojs/nitro
-
pending triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
Los mantenedores suelen responder en 2 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
Los mantenedores suelen responder en 2 días
-
cloudflare: `nitro deploy` fails when a parent directory has a Wrangler configPosiblemente ocupada @draarivpatel-ui la tomó hace 13 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 2 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 2 días
-
pending triage
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
nitrojs/nitro#5205 · 1 reacción ·
Los mantenedores suelen responder en 2 días
Todos los issues de nitrojs/nitro
Issues similares
-
bug data-types
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
ClickHouse/clickhouse-js#1293 ·
Los mantenedores suelen responder en 1 día
-
area: middleware enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
agent/quality testing
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
juspay/agent-distro#203 ·
Los mantenedores suelen responder en 1 día