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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Faarh2Ts6StJPcz2mRiHiR
This commit is contained in:
@@ -308,6 +308,10 @@ Each module depends only on the ones listed above it.
|
|||||||
| `gesture/recognizer.ts` | Pointer-down admission, `DirectionalTracker`, `GestureRecognizer`, and `useOriginGesture` |
|
| `gesture/recognizer.ts` | Pointer-down admission, `DirectionalTracker`, `GestureRecognizer`, and `useOriginGesture` |
|
||||||
| `components/` | `OriginScene`, `OriginGesture`, `OriginGestureSurface`, and the internal node host |
|
| `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
|
Pure helpers used by a class (for example `matchesStart`, `stepSpring`, or
|
||||||
`composeNodeStyle`) are module-level `export const`s that the class calls, so
|
`composeNodeStyle`) are module-level `export const`s that the class calls, so
|
||||||
they can be tested directly without widening the class's interface.
|
they can be tested directly without widening the class's interface.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
useOriginGesture,
|
useOriginGesture,
|
||||||
type OriginGestureBinding,
|
type OriginGestureBinding,
|
||||||
type OriginGestureCompletionContext,
|
type OriginGestureCompletionContext,
|
||||||
} from ".";
|
} from "../src";
|
||||||
|
|
||||||
const mountedApps: Array<ReturnType<typeof createApp>> = [];
|
const mountedApps: Array<ReturnType<typeof createApp>> = [];
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
originView,
|
originView,
|
||||||
useOriginGesture,
|
useOriginGesture,
|
||||||
type OriginGestureDefinition,
|
type OriginGestureDefinition,
|
||||||
} from ".";
|
} from "../src";
|
||||||
|
|
||||||
const apps: Array<ReturnType<typeof createApp>> = [];
|
const apps: Array<ReturnType<typeof createApp>> = [];
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -23,9 +23,9 @@ import {
|
|||||||
under,
|
under,
|
||||||
type OriginAction,
|
type OriginAction,
|
||||||
type OriginOperationHandle,
|
type OriginOperationHandle,
|
||||||
} from ".";
|
} from "../src";
|
||||||
import type { SceneGraph } from "./scene/graph";
|
import type { SceneGraph } from "../src/scene/graph";
|
||||||
import type { OriginScene as Scene } from "./scene/types";
|
import type { OriginScene as Scene } from "../src/scene/types";
|
||||||
|
|
||||||
const SEEDS = Number(process.env.PROPERTY_SEEDS ?? 60);
|
const SEEDS = Number(process.env.PROPERTY_SEEDS ?? 60);
|
||||||
|
|
||||||
@@ -19,8 +19,8 @@ import {
|
|||||||
OriginSceneError,
|
OriginSceneError,
|
||||||
originView,
|
originView,
|
||||||
type OriginGestureDefinition,
|
type OriginGestureDefinition,
|
||||||
} from ".";
|
} from "../src";
|
||||||
import { shouldCommit } from "./scene/graph";
|
import { shouldCommit } from "../src/scene/graph";
|
||||||
|
|
||||||
const apps: Array<ReturnType<typeof createApp>> = [];
|
const apps: Array<ReturnType<typeof createApp>> = [];
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
originView,
|
originView,
|
||||||
replace,
|
replace,
|
||||||
under,
|
under,
|
||||||
} from ".";
|
} from "../src";
|
||||||
|
|
||||||
const mountedApps: Array<ReturnType<typeof createApp>> = [];
|
const mountedApps: Array<ReturnType<typeof createApp>> = [];
|
||||||
|
|
||||||
@@ -9,6 +9,5 @@
|
|||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"tsBuildInfoFile": "../../node_modules/.tmp/core-v2.tsbuildinfo"
|
"tsBuildInfoFile": "../../node_modules/.tmp/core-v2.tsbuildinfo"
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.vue"],
|
"include": ["src/**/*.ts", "src/**/*.vue"]
|
||||||
"exclude": ["src/**/*.test.ts"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
Run each implementation in its own process with `ONLY=`; running both in one
|
||||||
process biases whichever runs second.
|
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
|
drives random operation sequences and pointer streams and checks the scene's
|
||||||
structural invariants after every step. Set `PROPERTY_SEEDS` to run more.
|
structural invariants after every step. Set `PROPERTY_SEEDS` to run more.
|
||||||
|
|||||||
+2
-1
@@ -24,6 +24,7 @@
|
|||||||
"apps/demo/src/**/*.ts",
|
"apps/demo/src/**/*.ts",
|
||||||
"apps/demo/src/**/*.vue",
|
"apps/demo/src/**/*.vue",
|
||||||
"packages/*/src/**/*.ts",
|
"packages/*/src/**/*.ts",
|
||||||
"packages/*/src/**/*.vue"
|
"packages/*/src/**/*.vue",
|
||||||
|
"packages/*/tests/**/*.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user