Skip to content

Testing

Director's shipped tests are minimal: four unit-test specs in src/services/__tests__/, run by the workspace's run-node-tests.cjs wrapper around the Node 20 built-in test runner.

What's tested today

src/services/__tests__/
├── DirectorRuntimeAdapter.spec.ts
├── DirectorStandaloneMode.spec.ts
├── DirectorTopology.spec.ts
└── DirectorWorkstreamSupport.spec.ts

Each spec exercises a pure-function or pure-class boundary on the adapter layer. There are no UI/component tests in the shipped tree as of 2026-05-05.

package.json:

json
"test:ci": "node ../../scripts/run-node-tests.cjs -- src/services/__tests__/*.spec.ts"

Run it:

bash
cd projects/matrix-3/packages/director
pnpm test:ci

What's not tested today

Honest accounting of gaps:

  • No component-level tests. No DOM-fixture rendering of DirectorTree, DirectorDetail, or DirectorOpsFeed. These would require a JSDOM or Happy-DOM harness and are not present.
  • No end-to-end Playwright tests in the package. playwright.config.ts exists but the e2e/ directory holds only legacy fixtures — there is no committed Director e2e suite that an agent should rely on for proofs.
  • No accessibility tests. Color contrast, keyboard navigation, ARIA roles — none audited automatically.
  • No live RPC fuzzing. Adapter behavior under malformed responses is partially covered by the unit tests but not exhaustively.

For the broader workstream context, see WORKSTREAMS/loose-ends/items/P1.11-cognitive-product-proof.md, which is the open E2E proof that should drive Director-side test investment.

How to run unit tests under tsx

If you need to run a single spec quickly without going through the workspace wrapper:

bash
cd projects/matrix-3/packages/director
npx tsx --test src/services/__tests__/DirectorTopology.spec.ts

Note: the spec files import from sibling source TypeScript directly. They do not import from dist/. That avoids stale-bundle false negatives.

Type check

bash
pnpm type-check        # tsc --noEmit on the package

Build verification

The cheapest proof Director still composes:

bash
node build.mjs
ls dist/index.html

If dist/index.html exists and the lazy chat-surface chunk is present in dist/assets/, the build succeeded.

Manual UI verification

Until automated UI tests land, manual verification is via Playwright MCP against a running Host (per CLAUDE.md "END TO END TESTING"):

  1. Start a Host (hivecast install, hivecast start).
  2. Navigate to http://127.0.0.1:3100/apps/director/.
  3. Read browser-console for NATS permission errors, missing introspection, etc.
  4. Open the actor tree, click a known mount, verify the detail tabs populate.

HTTP 200 alone is not proof. Read the console.

Target state

The intended test pyramid (when written):

  • Unit tests for every adapter method (existing 4 specs are a starting point).
  • DOM-fixture tests for each shell (director-tree, director-detail, director-ops-feed) using JSDOM.
  • An end-to-end suite that boots a worker-container Host, opens Director, and verifies the runtime tree, the Ops Feed, and the Chat tab.

None of those are in the current code.

See also

Source: projects/matrix-3/packages/director/src/services/__tests__/, package.json, playwright.config.ts.