-
Notifications
You must be signed in to change notification settings - Fork 0
Testing
Tests run on Vitest via the Vite+ runner (vp test). Configuration is in vite.config.ts under the test key.
← Back to Home · Related: Contributing · Build & Publishing
Tests are colocated with the code they cover as *.test.ts:
src/
├── rss/RSSFeed.test.ts
├── component/HTMLMapper.test.ts
├── component/Component.test.ts
├── component/mapping/Mapping.test.ts
├── component/node/Node.test.ts
└── component/schema/Schema.test.ts
setupFiles runs src/setupTests.ts, which exposes process.env.SUPPORT_PATH and process.env.FEEDS_PATH so tests read fixtures (under src/support/) without hardcoded paths.
| Command | What it does |
|---|---|
npm test |
Run the full suite once (vp test). |
npm run test:debug |
No timeout, no file parallelism (for debugging/breakpoints). |
npm run test:ui |
Watch mode + interactive Vitest UI. |
npm run coverage |
Run the suite with a v8 coverage report. |
npm run coverage:ui |
Coverage in watch mode + UI. |
Run a single file:
npx vitest run src/rss/RSSFeed.test.tsTests are tagged via { tags: [...] } in their Vitest options. The configured tags are:
| Tag | Meaning |
|---|---|
unit |
Isolated logic. |
rss |
Feed structure / XML / channel metadata. |
html |
DOM → component conversion. |
integration |
Cross-module / network tests — skipped by default. |
recipe |
JSON-LD recipe extraction (network) — skipped by default. |
todo |
Incomplete / under development. |
broken |
Known-failing, needs fixing. |
The UI scripts filter on a tag, e.g. npm run test:unit, npm run test:integration, npm run test:todo, npm run test:broken.
integrationandrecipeare skipped invite.config.tsbecause they make network requests. Tag new tests appropriately:unitfor isolated logic,rssfor feed parsing,htmlfor component conversion.
Coverage uses the v8 provider and is gated by thresholds in vite.config.ts; npm run coverage fails if any drops below:
| Metric | Minimum |
|---|---|
| Statements | 95% |
| Branches | 88% |
| Functions | 99% |
| Lines | 97% |
src/index.ts, config files, and *.d.ts are excluded from coverage.
CI (and good practice before a PR) runs:
npm run lint && npm run coverageSee Contributing.
Start here
Reference
Operations