From a46c411ec44c6846987baf79d13cf21996b2b2a5 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 16 Oct 2026 04:24:47 +0000 Subject: [PATCH] Move core-v2 tests into packages/core-v2/tests Tests no longer sit next to the implementation. They import the package through ../src, the root tsconfig still type-checks them, and the package build and declarations cover only src/. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Faarh2Ts6StJPcz2mRiHiR --- packages/core-v2/README.md | 4 ++++ packages/core-v2/{src => tests}/gesture.test.ts | 2 +- packages/core-v2/{src => tests}/haptics.test.ts | 2 +- packages/core-v2/{src => tests}/property.test.ts | 6 +++--- packages/core-v2/{src => tests}/recognizer.test.ts | 4 ++-- packages/core-v2/{src => tests}/scene.test.ts | 2 +- packages/core-v2/tsconfig.json | 3 +-- packages/core-v2/verify/README.md | 2 +- tsconfig.app.json | 3 ++- 9 files changed, 16 insertions(+), 12 deletions(-) rename packages/core-v2/{src => tests}/gesture.test.ts (99%) rename packages/core-v2/{src => tests}/haptics.test.ts (99%) rename packages/core-v2/{src => tests}/property.test.ts (99%) rename packages/core-v2/{src => tests}/recognizer.test.ts (99%) rename packages/core-v2/{src => tests}/scene.test.ts (99%) diff --git a/packages/core-v2/README.md b/packages/core-v2/README.md index f546a58..b66a50b 100644 --- a/packages/core-v2/README.md +++ b/packages/core-v2/README.md @@ -308,6 +308,10 @@ Each module depends only on the ones listed above it. | `gesture/recognizer.ts` | Pointer-down admission, `DirectionalTracker`, `GestureRecognizer`, and `useOriginGesture` | | `components/` | `OriginScene`, `OriginGesture`, `OriginGestureSurface`, and the internal node host | +Tests live in `tests/`, outside `src/`. `tests/property.test.ts` checks the +scene's structural invariants after every step of random operation sequences +and pointer streams; set `PROPERTY_SEEDS` to run more than the default 60. + Pure helpers used by a class (for example `matchesStart`, `stepSpring`, or `composeNodeStyle`) are module-level `export const`s that the class calls, so they can be tested directly without widening the class's interface. diff --git a/packages/core-v2/src/gesture.test.ts b/packages/core-v2/tests/gesture.test.ts similarity index 99% rename from packages/core-v2/src/gesture.test.ts rename to packages/core-v2/tests/gesture.test.ts index 1e45289..95d909f 100644 --- a/packages/core-v2/src/gesture.test.ts +++ b/packages/core-v2/tests/gesture.test.ts @@ -13,7 +13,7 @@ import { useOriginGesture, type OriginGestureBinding, type OriginGestureCompletionContext, -} from "."; +} from "../src"; const mountedApps: Array> = []; diff --git a/packages/core-v2/src/haptics.test.ts b/packages/core-v2/tests/haptics.test.ts similarity index 99% rename from packages/core-v2/src/haptics.test.ts rename to packages/core-v2/tests/haptics.test.ts index d939045..38d53e6 100644 --- a/packages/core-v2/src/haptics.test.ts +++ b/packages/core-v2/tests/haptics.test.ts @@ -19,7 +19,7 @@ import { originView, useOriginGesture, type OriginGestureDefinition, -} from "."; +} from "../src"; const apps: Array> = []; afterEach(() => { diff --git a/packages/core-v2/src/property.test.ts b/packages/core-v2/tests/property.test.ts similarity index 99% rename from packages/core-v2/src/property.test.ts rename to packages/core-v2/tests/property.test.ts index e4dbb19..420ebd4 100644 --- a/packages/core-v2/src/property.test.ts +++ b/packages/core-v2/tests/property.test.ts @@ -23,9 +23,9 @@ import { under, type OriginAction, type OriginOperationHandle, -} from "."; -import type { SceneGraph } from "./scene/graph"; -import type { OriginScene as Scene } from "./scene/types"; +} from "../src"; +import type { SceneGraph } from "../src/scene/graph"; +import type { OriginScene as Scene } from "../src/scene/types"; const SEEDS = Number(process.env.PROPERTY_SEEDS ?? 60); diff --git a/packages/core-v2/src/recognizer.test.ts b/packages/core-v2/tests/recognizer.test.ts similarity index 99% rename from packages/core-v2/src/recognizer.test.ts rename to packages/core-v2/tests/recognizer.test.ts index c7caaaa..bfcb677 100644 --- a/packages/core-v2/src/recognizer.test.ts +++ b/packages/core-v2/tests/recognizer.test.ts @@ -19,8 +19,8 @@ import { OriginSceneError, originView, type OriginGestureDefinition, -} from "."; -import { shouldCommit } from "./scene/graph"; +} from "../src"; +import { shouldCommit } from "../src/scene/graph"; const apps: Array> = []; afterEach(() => { diff --git a/packages/core-v2/src/scene.test.ts b/packages/core-v2/tests/scene.test.ts similarity index 99% rename from packages/core-v2/src/scene.test.ts rename to packages/core-v2/tests/scene.test.ts index 97359a3..e36a645 100644 --- a/packages/core-v2/src/scene.test.ts +++ b/packages/core-v2/tests/scene.test.ts @@ -18,7 +18,7 @@ import { originView, replace, under, -} from "."; +} from "../src"; const mountedApps: Array> = []; diff --git a/packages/core-v2/tsconfig.json b/packages/core-v2/tsconfig.json index 6dd71ae..e5b3341 100644 --- a/packages/core-v2/tsconfig.json +++ b/packages/core-v2/tsconfig.json @@ -9,6 +9,5 @@ "outDir": "dist", "tsBuildInfoFile": "../../node_modules/.tmp/core-v2.tsbuildinfo" }, - "include": ["src/**/*.ts", "src/**/*.vue"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*.ts", "src/**/*.vue"] } diff --git a/packages/core-v2/verify/README.md b/packages/core-v2/verify/README.md index 00f08f5..9e4771c 100644 --- a/packages/core-v2/verify/README.md +++ b/packages/core-v2/verify/README.md @@ -15,6 +15,6 @@ ONLY=rewrite npx vitest bench --run --config packages/core-v2/verify/vitest.conf Run each implementation in its own process with `ONLY=`; running both in one process biases whichever runs second. -Behavioural verification lives with the unit tests: `src/property.test.ts` +Behavioural verification lives with the unit tests: `tests/property.test.ts` drives random operation sequences and pointer streams and checks the scene's structural invariants after every step. Set `PROPERTY_SEEDS` to run more. diff --git a/tsconfig.app.json b/tsconfig.app.json index a7593b8..30ae69a 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -24,6 +24,7 @@ "apps/demo/src/**/*.ts", "apps/demo/src/**/*.vue", "packages/*/src/**/*.ts", - "packages/*/src/**/*.vue" + "packages/*/src/**/*.vue", + "packages/*/tests/**/*.ts" ] }