Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
"package:mac": "electron-builder --mac --publish never",
"dist:mac": "npm run build && npm run package:mac",
"start": "electron-vite preview",
"testing:rendering": "npm run testing:rendering:build && electron testing/rendering/out/main/main.js",
"testing:rendering:build": "electron-vite build --config testing/rendering/electron.vite.config.ts",
"testing:rendering:preview": "electron testing/rendering/out/main/main.js",
"test": "NODE_ENV=test vitest run",
"test:watch": "NODE_ENV=test vitest",
"test:unit": "NODE_ENV=test vitest run --project unit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ describe('provider session identity helpers', () => {
it('keeps jsonl-entry and legacy provider ids resumable', () => {
expect(hasDurableProviderSession(durableMeta)).toBe(true)
expect(resumableProviderSessionId(durableMeta)).toBe('durable-1')
expect(hasDurableProviderSession({
cwd: '/repo',
kind: 'claude',
providerSessionId: 'legacy-1',
})).toBe(true)
// hasDurableProviderSession only reads providerSessionId / *IdSource, so
// pass exactly that Pick — the old {cwd,kind,…} extras were untyped noise
// that the web tsconfig now (rightly) rejects once this test is colocated.
expect(hasDurableProviderSession({ providerSessionId: 'legacy-1' })).toBe(true)
})

it('upgrades a proxy-header id when JSONL confirms the same provider session', () => {
Expand Down
File renamed without changes.
37 changes: 24 additions & 13 deletions testing/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
# Agent Code Test Suite
# Agent Code Test Infrastructure

This directory holds shared test infrastructure, fixtures, and manual harnesses.
Normal tests should live beside the production module they protect whenever
that makes ownership obvious.
Tests live **beside the production module they protect** (`foo.ts` →
`foo.test.ts`). This directory is only for the few things that *can't* be
colocated:

- **`fixtures/`** — the rendering corpus (`rendering-bundles/`,
`rendering-recordings/`) replayed by `src/renderer/src/rendering/bundleCorpus.test.ts`
and `recordingCorpus.test.ts`. The regression net for the rendering pipeline.
- **`setup/renderer.ts`** — happy-dom setup file for the `renderer` Vitest project.
- **`unit/channels/`, `unit/proxy/`** — tests for `packages/claude-code-headless`
(a git submodule). They live here because a test file can't be colocated
*inside* a submodule from this repo.

Everything else — pure functions, reducers, selectors, mappers, ledgers,
components — is colocated under `src/`. If you're reaching for `testing/` for a
new test, it almost certainly belongs next to its source instead.

## Commands

```bash
npm test
npm test # all projects
npm run test:unit
npm run test:integration
npm run test:renderer
```

## Test Layers
## Projects (see `vitest.config.ts`)

- `unit`: pure functions, reducers, selectors, mappers, ownership ledgers.
- `integration`: multiple Node/app modules wired together without Electron.
- `renderer`: React component tests in `happy-dom`.
- `unit` — node env: `src/**/*.test.ts`, `packages/**`, `testing/unit/**`
- `integration` — node env: `**/*.integration.test.ts`
- `renderer` — happy-dom: `**/*.renderer.test.{ts,tsx}` (+ `testing/setup/renderer.ts`)

## Policy

Do not add new `scripts/test-*.ts` files. The old script tests were useful as
incident probes, but they are not the project test architecture. New coverage
belongs in Vitest.

Do not add `scripts/test-*.ts` files — the old script tests were incident
probes, not the test architecture. New coverage is a Vitest file next to its
source.
279 changes: 0 additions & 279 deletions testing/ghost-demo/bridge.mts

This file was deleted.

Loading