testing-practiceslisted
Install: claude install-skill Aquaticat/Monochromatic
# Testing practices
Fires when writing or modifying tests,
picking a test pattern,
or reviewing
test code in this monorepo.
The skill covers the module-test harness,
the describe/it API,
test file
conventions,
coverage,
parameterized tests,
async patterns,
and sinon
integration.
## Test framework
- Unit tests use `@monochromatic-dev/module-test/ts`,
a custom harness built on chai,
sinon,
and expect-type
- Unit tests import package behavior from built `dist`,
never from sibling source files
- Browser and e2e tests use Playwright,
executed inside a podman container
- All tests run through `mise run`;
never invoke `bun test` or `playwright` directly
- Each test file is self-contained with top-level `await describe(...)`;
no external test runner needed
## Running tests
```bash
# Build all packages, then run all tests (unit + browser + e2e)
mise run buildAndTest # alias: bt
# Build, then run a specific unit test file
mise run buildAndTest -- package/module/async-time/src/wait.unit.test.ts
# Run tests only when dist is already fresh
mise run test # alias: t
# Watch mode
mise run watch:test # alias: tW
```
**Required for unit tests**:
unit tests import package code from built `dist`.
Run `mise run buildAndTest` after source changes,
including when narrowing to one file,
because `mise run test` alone can exercise stale artifacts.
Use a package-scoped test task only after the same verification sequence rebuilt its artifact.
Harness