Running Tests
May 27, 2026 · View on GitHub
JoSk's test suite combines:
- Mocha (
test/npm.js,test/npm-redis.js,test/npm-mongo.js,test/npm-postgres.js) — historical adapter-specific integration tests that run against live servers. - Jest (
test/jest/core.test.js,test/jest/adapters.test.js) — core scheduler tests plus live adapter contract tests. Doubles as the Bun test suite viabun:test(npm run test:bun). tsc— TypeScript declaration smoke test (npm run test:types).
Setup
-
Clone this repository.
-
From the repo root, install dev dependencies:
npm install --save-dev -
Provide live Redis, MongoDB, and PostgreSQL servers. The test harness reads connection strings from:
REDIS_URL— e.g.redis://127.0.0.1:6379MONGO_URL— e.g.mongodb://127.0.0.1:27017/npm-josk-test-001PG_URL— e.g.postgres://postgres:postgres@localhost:5432/npm-josk-test-001
Run all tests
REDIS_URL="redis://127.0.0.1:6379" \
MONGO_URL="mongodb://127.0.0.1:27017/npm-josk-test-001" \
PG_URL="postgres://postgres:postgres@localhost:5432/npm-josk-test-001" \
npm test
The full suite (Mocha + Jest + tsc) takes ~6 minutes.
Targeted runs
# Jest core + live adapter contract tests
npm run test:jest
# Same Jest suite under Bun (bun:test)
npm run test:bun
# Coverage (Jest only — Mocha suites add to coverage when run separately)
npm run test:coverage
# TypeScript declaration smoke test
npm run test:types
# Per-adapter Mocha runs (require live servers)
REDIS_URL="redis://127.0.0.1:6379" npm run test:redis # ~3 min
MONGO_URL="mongodb://127.0.0.1:27017/db" npm run test:mongo # ~3 min
PG_URL="postgres://postgres@localhost/db" npm run test:postgres # ~3 min
Verbose mode
DEBUG=true REDIS_URL="…" MONGO_URL="…" PG_URL="…" npm test