Tests

This project uses two separate Jest runners to handle the mixed runtime requirements of Node build scripts and React frontend components.

Contents

Test runners

Two runners are needed because CRA injects its own Babel and CSS transform pipeline; running CRA tests with raw Jest fails to parse CSS and static asset imports.

Runner Command Config Scope
Node npm run test:node jest.node.config.js src/__tests__/
CRA npm run test:cra CRA built-in src/**/*.test.{js,jsx}

Combined commands:

Command Description
npm run test:all Runs both runners sequentially
npm run test:ci Non-interactive CI mode for both runners
npm run test:helpers Runs only src/__tests__/fetchHelpers

Coverage

No minimum coverage thresholds are currently enforced. Run npm run test:node -- --coverage to generate a local HTML report and view current percentages.

Metric Threshold How to check
Statements Not enforced npm run test:node -- --coverage
Branches Not enforced npm run test:node -- --coverage
Functions Not enforced npm run test:node -- --coverage
Lines Not enforced npm run test:node -- --coverage

Coverage is collected from config/jest/**/*.js, src/**/*.{js,jsx}, and scripts/**/*.js.

Running tests locally

  1. Install dependencies: npm install
  2. Run the Node runner: npm run test:node
  3. Run the CRA runner: npm run test:cra
  4. Run both at once: npm run test:all
  5. For CI (non-interactive, no watch mode): npm run test:ci

Reading the coverage report

After running npm run test:node -- --coverage, open coverage/index.html in a browser to see the full line-by-line HTML report. A machine-readable summary is also written to coverage/coverage-summary.json.

What is tested and what is excluded

Tested source locations:

Intentionally excluded from coverage:

Troubleshooting

References