Background
#1307 added a new `integration` vitest project for v1.5-ported tests that need node env + 30s timeouts. Membership is controlled by an explicit `integrationTests` array in `clients/web/vite.config.ts`:
```ts
const integrationTests = [
'clients/web/src/test/core/inspectorClient.test.ts',
...
];
projects: [
{ name: 'unit', include: ['clients/web/src/**/*.test.{ts,tsx}'], exclude: integrationTests },
{ name: 'integration', include: integrationTests },
]
```
A new test file under `src/test/core/` that isn't added to `integrationTests` silently falls into the unit project and runs under happy-dom. There's a comment acknowledging this, but it's a sharp edge: an integration-style test that should spawn a real server will fail (or pass for the wrong reasons) under happy-dom with no signal at authoring time.
Proposed change
Flip the manifest so the project that runs is determined by file location rather than enumeration:
```ts
{ name: 'unit', include: ['clients/web/src//*.test.{ts,tsx}'], exclude: ['clients/web/src/test/integration/'] },
{ name: 'integration', include: ['clients/web/src/test/integration/**/*.test.ts'] },
```
This means either:
A) Move the 13 integration tests under a dedicated `src/test/integration/` folder (with sub-paths mirroring source layout) and drop the explicit `integrationTests` array. Cleanest, but it's a 13-file rename + import-path audit.
B) Keep tests where they are, add a per-file marker (e.g. a regex on the first line — `/* @vitest-environment node */`) and have the integration project glob with a filter. More plumbing, less file movement.
Recommend (A) — the rename is mechanical and the layout becomes self-documenting.
Why
- Removes the developer trap entirely — there's no way to add a node-env test that accidentally runs under happy-dom (or vice versa).
- The `integrationTests` array would no longer drift from reality silently.
- Layout matches how most monorepos disambiguate test scopes (`unit/`, `integration/`, `e2e/`).
Acceptance criteria
Out of scope
- Renaming the unit-test directory structure or introducing a third project.
- Changing what counts as "integration" — same 13 files in scope.
Origin
PR #1312 review comment (observation #5).
Background
#1307 added a new `integration` vitest project for v1.5-ported tests that need node env + 30s timeouts. Membership is controlled by an explicit `integrationTests` array in `clients/web/vite.config.ts`:
```ts
const integrationTests = [
'clients/web/src/test/core/inspectorClient.test.ts',
...
];
projects: [
{ name: 'unit', include: ['clients/web/src/**/*.test.{ts,tsx}'], exclude: integrationTests },
{ name: 'integration', include: integrationTests },
]
```
A new test file under `src/test/core/` that isn't added to `integrationTests` silently falls into the unit project and runs under happy-dom. There's a comment acknowledging this, but it's a sharp edge: an integration-style test that should spawn a real server will fail (or pass for the wrong reasons) under happy-dom with no signal at authoring time.
Proposed change
Flip the manifest so the project that runs is determined by file location rather than enumeration:
```ts
{ name: 'unit', include: ['clients/web/src//*.test.{ts,tsx}'], exclude: ['clients/web/src/test/integration/'] },
{ name: 'integration', include: ['clients/web/src/test/integration/**/*.test.ts'] },
```
This means either:
A) Move the 13 integration tests under a dedicated `src/test/integration/` folder (with sub-paths mirroring source layout) and drop the explicit `integrationTests` array. Cleanest, but it's a 13-file rename + import-path audit.
B) Keep tests where they are, add a per-file marker (e.g. a regex on the first line — `/* @vitest-environment node */`) and have the integration project glob with a filter. More plumbing, less file movement.
Recommend (A) — the rename is mechanical and the layout becomes self-documenting.
Why
Acceptance criteria
Out of scope
Origin
PR #1312 review comment (observation #5).