1.0 KiB
1.0 KiB
name, description, paths
| name | description | paths | |
|---|---|---|---|
| tests | Rules for integration test files at project root |
|
- File names match the pattern
test-<module>.jsand live at the project root alongsidepackage.json. - Every test file has a matching npm script
test:<module>inpackage.json. Thetestaggregate script runs them all. When you add a newtest-*.js, add it to both places. - Runner is
node --test(built-in, Node ≥22). Scripts that hit the DB pass--experimental-sqlite. - Database in tests is an in-memory
better-sqlite3instance built via the samebuildSchemapath used by production. Never mockbetter-sqlite3. Never stub out migrations. If a test needs seed data, insert it through normal route handlers or the same queries prod uses. - Assertions via
node:assert/strict. Imports useimportsyntax. Norequire. - Tests must be deterministic. No network calls, no real filesystem writes outside
os.tmpdir(), noDate.now()without faking. - A failing test is a real failure. Don't wrap in
t.skipor comment out to make CI green.