-
100% coverage is enforced. Each of the three library packages'
jest.config.jssets acoverageThreshold.globalof 100% (branches/functions/lines/statements). A new branch or line without a covering test failsnpm test. Add tests for every path, including error paths. (Theexamplesworkspace has no test suite — its scripts are no-ops.) -
Network is expected to be stubbed. Tests use
nockto intercept JWKS and OAuth discovery requests. A code path that makes an unmocked outbound call will hang or fail — register anockinterceptor for the well-known metadata and JWKS endpoints. -
Respect the package layering.
express-oauth2-jwt-bearer→access-token-jwt→oauth2-bearer. Don't add an upward dependency (a lower package importing a higher one) or a circular one. Shared logic belongs in the lowest package that needs it. -
Cross-package imports resolve to
src/, notdist/. Tests import siblings by package name (access-token-jwt,oauth2-bearer) via JestmoduleNameMapper+ ts-jestpaths. This works without building, but means a build-time-only mistake (e.g. a bad barrel export) may pass tests yet break the Rollup bundle — runnpm run buildwhen touching exports. -
jwt-verifier.tsandtoken-verifier.tsare large and security-critical. Most validation logic (issuer resolution, algorithm allowlist, audience, DPoP wiring) lives here. Changes have wide blast radius and touch security — keep edits surgical, add targeted tests, and treat validation-weakening changes as Ask First. -
Only
express-oauth2-jwt-beareris published.oauth2-bearerandaccess-token-jwtareprivate: trueat0.0.1and shipped bundled into the published package. Don't document them as separately installable, and remember the published version source ispackages/express-oauth2-jwt-bearer/.version. -
Two build tools. Internal packages use
tsc; the published package uses Rollup (rollup.config.mjs). When changing build behavior, edit the right one. -
No telemetry by design. This is an API-side validator — it must not send an
Auth0-Clientheader or call Auth0 auth endpoints. Don't "add telemetry" here.