directus-main — testing strategy
Every workspace runs its own real vitest run, with coverage checked per package rather than one
monorepo-wide blended number. See Auth & Request Flow for a real bug this same
testing discipline caught later, in a different package.
PERMISSION_ACTIONS,
LOCAL_AUTH_DRIVER — nothing to mock because there's no behavior, only constants.
toString(), plus
isDirectusError identification — including a real regression test for an empty-string
reason that used to silently fall through ?? instead of falling back.
types.ts type surface — filters, permissions, collection/field/relation metadata. All
type-only (expectTypeOf), checked only by yarn typecheck;
vitest run treats these assertions as inert no-ops at runtime, so 0/0 coverage here is correct, not
a gap.
toBoolean/toArray done so far, 2 of a
real 61-function scope. The first package in this repo to depend on another real package (constants
+ system-data).
environment: 'node' — no DOM needed). 100% coverage was already
true before a completeness audit found 4 real gaps it hadn't caught anyway.
@vue/test-utils + happy-dom, plus real headless-browser
verification (Playwright) for anything a unit test can't prove — the actual rendered login page, and the live
GitHub Pages deploy's routing end to end.
supertest against the exported app, so no real port gets bound.
One disclosed gap: app.listen's own callback body is genuinely unreachable under
NODE_ENV=test, by design — not hidden behind a coverage-ignore pragma.
format → build → lint → lint:style → test
build runs before lint/test deliberately — see
System Architecture for the real CI failure that ordering fixed.
The same five gates, plus CodeQL
Never assumed green from a local run alone — every push is watched through to a real
gh run watch --exit-status before being called done.
100% coverage still let 4 real gaps through: a completeness audit — prompted by comparing
packages/stores's own file count against the real source — found that auth.test.ts/user.test.ts
only ever asserted derived values (loggedIn, fullName), never the raw stored
state; a bug that swapped two stored fields would still have passed every existing test. Every line was already
executing — coverage just can't tell you the right value ended up in the right place. Fixed with explicit
toEqual assertions on the actual stored objects, alongside two smaller gaps in the same pass (a
missing type export, a package.json exports map blocking the package's own
package.json
resolution).