| name | testing |
|---|---|
| description | Jest setup, test layout and mocks, coverage reports, pretest build, and no live API tests |
- Running or debugging tests, adding new tests, or understanding why
npm testruns a build first.
- Jest 29 + ts-jest (
jest.config.ts). - Environment:
jsdom(HTML/DOM-oriented assertions where relevant).
| Command | Behavior |
|---|---|
npm test |
Runs pretest → npm run build, then Jest with coverage; reports under reports/ |
npm run test:debug |
Jest --watchAll with --runInBand |
- Match:
**/__test__/**/?(*.)+(spec|test).[jt]s?(x)— this repo uses__test__/**/*.test.ts. - Mocks / fixtures:
__test__/mock/(e.g.entry-mock.ts,json-element-mock.ts).
- Coverage from
src/**excludingsrc/index.ts(collectCoverageFrominjest.config.ts). - Outputs:
reports/coverage/,reports/html/,reports/junit/,reports/report.json(from thenpm testscript).
- No API keys or
.envfor unit tests. - No live/integration tests against a stack in this repository.
pretestalways builds — ensuresrc/assets/regions.jsonexists or can be downloaded (download-regionsinprebuild) soendpointsand related tests behave consistently.
- Prefer explicit objects over network calls—this library does not ship an HTTP client; avoid introducing network I/O in tests unless the project adds gated integration tests later.