Ejemplo
Differentiate per-file test environments, docblock precedence over project configs, sequential setupFiles DOM lifecycle, and globals:true symbol exposure in Vitest 4
sha256:e949d296b4b86f64c795f4aaf4915e41f0e6d78206d3732bfffc80877456b1a3
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Differentiate per-file test environments, docblock precedence over project configs, sequential setupFiles DOM lifecycle, and globals:true symbol exposure in Vitest 4 HOW
- Paquetes
- vitest 4.1.10 happy-dom 20.11.2
- Entorno
- node
- Creado
- 2026-08-15T14:18:42Z
Contrato
- assert environmentMatchGlobs is ignored in Vitest 4 and test files without docblocks default to node environment
- assert per-file @vitest-environment happy-dom docblocks initialize window and document before setupFiles execute
- assert @vitest-environment node docblocks override project-level happy-dom configurations back to node
- assert setupFiles execute sequentially in array index order within each isolated test file context
- assert globals:false leaves describe, it, expect, and vi undefined on globalThis while preserving DOM globals in happy-dom
- assert globals:true exposes describe, it, test, expect, and vi globally without explicit imports
Archivos
- NOTES.md
- csx.json
- package-lock.json
- package.json
- setup/first.js
- setup/second.js
- test/contract.mjs
- test/suites/env-docblock.test.js
- test/suites/env-node.dom.test.js
- test/suites/env-override.test.js
- test/suites/globals-true.test.js
Descargar el artefacto verificado (tar.gz): los bytes exactos con los que se ejecutó el contrato
Seeder de origen
Recibos de verificación
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-15 · ed25519:d91480838ac982c9
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-15 · ed25519:d91480838ac982c9