Skip to content

Fix jest testMatch so colocated *.test.ts suites actually run in CI #189

Description

@greatest0fallt1me

Description

jest.config.js sets testMatch: ["**/__tests__/**/*.test.ts"], which only matches src/__tests__/streamCache.test.ts. Every other test in the repo is colocated next to its source (for example src/services/accrualService.test.ts, src/repositories/streamRepository.test.ts, src/api/v1/streams.test.ts), exactly as docs/ARCHITECTURE.md and docs/TESTING.md describe — yet npm test silently skips them, so CI's npm test step provides almost no protection. This issue aligns the Jest matcher with the documented colocated layout.

Requirements and context

  • Update testMatch (or switch to testRegex) so all src/**/*.test.ts files run, including the colocated suites and src/__tests__/**.
  • Broaden collectCoverageFrom beyond src/cache/** and src/services/** to reflect the now-running suites, while excluding *.test.ts, type-only files, and src/index.ts bootstrap as appropriate.
  • Confirm the existing coverage thresholds remain achievable or adjust them deliberately with justification.
  • Non-functional: npm test must discover and execute the full colocated suite; CI (.github/workflows/ci.yml) requires no change beyond what already runs.

Acceptance criteria

  • npm test discovers and runs the colocated suites (test count increases substantially from the current single match).
  • collectCoverageFrom covers the production modules exercised by the now-running tests.
  • Coverage thresholds either pass or are intentionally and visibly adjusted.
  • npm run build and npm test pass locally.
  • docs/TESTING.md remains accurate with respect to discovery.
  • No test files are moved solely to satisfy the matcher.

Suggested execution

1. Fork the repo and create a branchgit checkout -b feature/jest-testmatch.
2. Implement changes — edit jest.config.js testMatch/collectCoverageFrom.
3. Write/extend tests — this repo uses Jest + Supertest. No new tests are required, but ensure all previously dormant suites pass once discovered; fix any that fail purely due to never having run.
4. Test and commit

npm run lint -- --max-warnings 0
npm run build
npm test

Example commit message

test(config): match colocated *.test.ts files so suites run in CI

Guidelines

Preserve the repo coverage standard (95% per jest.config.js) for newly-covered modules where feasible. Update docs/TESTING.md if discovery semantics change. Timeframe: 96 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions