Skip to content

Repository files navigation

sentinel

A test & QA harness in TypeScript — deterministic Vitest unit tests plus Playwright end-to-end tests that drive a real HTTP service. The E2E suite runs in Playwright's API mode (the request fixture), so the whole thing is green in CI without downloading a browser; add one line to extend it to full browser E2E.

typescript vitest playwright license


What's here

  • Unit tests done right (src/retry.ts + tests/) — a retry-with-backoff primitive whose every non-deterministic input (clock, jitter) is injectable, so the policy is asserted to the millisecond. No sleep, no flake.
  • E2E that actually exercises a service (e2e/) — Playwright boots the target API via webServer, waits for /healthz, then tests real request/response, validation (400), and routing (404).
  • Point it at anything — set BASE_URL and the E2E suite runs against any running service (e.g. the sibling marketpulse gateway), not just the bundled demo server.

Run it

npm install
npm test                 # vitest (5) + playwright (4)
npm run test:unit        # just the unit tests
PORT=9090 npm run test:e2e   # e2e on a chosen port
BASE_URL=http://localhost:8080 npm run test:e2e   # against a real service

Everything is one command in a container:

docker build -t sentinel . && docker run --rm sentinel

Layout

Path Role
src/retry.ts Unit-under-test: injectable backoff/jitter/sleep.
tests/retry.test.ts Vitest — success, retry, exhaustion, backoff math, cap.
e2e/server.ts Small target API (self-contained demo).
e2e/api.spec.ts Playwright API E2E — health, echo, 400, 404.
playwright.config.ts webServer boot + health-gate; PORT/BASE_URL configurable.

Notes for reviewers

  • Determinism over sleeps. Tests inject sleep/jitter; the suite never waits on wall-clock time, so it's fast and non-flaky.
  • No hidden browser download. API-mode E2E keeps CI light; browser specs are a documented one-liner (npx playwright install chromium) away.

The test/QA layer of a small polyglot portfolio — Go for networking, Python for high-level AI, TypeScript here, Rust for the from-scratch numerical core. — Nicholas Martins · github.com/nickmartins-lambda

About

TypeScript test/QA harness — Vitest unit tests + Playwright API end-to-end.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages