1.7 KiB
1.7 KiB
description
| description |
|---|
| Vitest via vp test; unit tests sit next to code as *.test.ts, regression/integration tests in tests/ via the public entry; scripts/ has no tests |
Decided 2026-10-14 for all repos.
- Runner: Vitest through
vp test. Import test APIs fromvite-plus/test(describe,expect,it). - Unit tests sit next to the code:
src/foo/bar.tsis tested insrc/foo/bar.test.ts. Vitest's default include finds them; notestconfig needed. Packages publish onlydist/, so colocated tests cost nothing in the tarball. - Regression and integration tests live in the top-level
tests/folder and use only the public entry point through a relative import (../src/index.ts; no alias may targetsrc/itself, see imports-aliases-barrels), never internals.vp test testsruns just these. - No in-source tests (
import.meta.vitest). scripts/gets no tests (2026-10-15): it is repo tooling, not production code (project-lint.ts,decorators.ts,lit-check.ts, release helpers).- Test files follow every lint rule; no relaxed overrides for tests.
Migrating Deno tests
Deno.test suites were converted by a codemod
(~/.local/share/deno-migration/src/convert.ts on the user's machine), then
its TODOs finished by hand. Watch for:
@std/assert→expect(assertEquals→toStrictEqualortoBe,assertThrows→toThrow,assertRejects→rejects.toThrow);Deno.*file, env, and process APIs →node:fs,process.env,node:child_process;t.step→ nesteddescribe/it;- sanitizer options, which Vitest doesn't have.
A migration PR must keep every test case; a dropped case is lost coverage. Tests must pass locally before any push.