Skip to content

Commit 208100b

Browse files
Sheraffclaudeautofix-ci[bot]
authored
feat(benchmarks): client-side CPU benchmark scenario suite (#7732)
* feat(benchmarks): add client-side CPU benchmark scenario suite Add 11 client-side CPU benchmark scenarios to benchmarks/client-nav, each implemented identically across react/solid/vue and tracked by CodSpeed through the existing Benchmarks workflow (no CI changes needed): async-pipeline, control-flow, head, history, links, loaders, mount, nested-params, preload, route-tree-scale, search-params Each scenario is an isolated file-based-routing app (route trees generated by @tanstack/router-plugin) built for production and driven in jsdom by a shared harness (scenarios/harness.ts): circular step sequences of real <Link> clicks (plus hover/preload/history-traversal/invalidate steps), each synchronized on the router's onRendered event, with a warm-up lap that asserts every step's observable output. Determinism rules: no wall-clock timers (counted 0ms hops only), staleTime/gcTime pinned to 0 or 1e9, deterministic preload staleness, stationary DOM and history depth. The existing baseline apps and bench names are untouched for CodSpeed continuity; baseline vite configs only gain an explicit root/setupFiles so they resolve identically under the new per-framework aggregate configs. Notable constraints encoded in the scenarios: - Component-level Await/Suspense is excluded from async-pipeline: React 19 throttles every Suspense reveal by ~300ms wall-clock, which is inherently non-deterministic to benchmark. - control-flow/react silences React 19's onCaughtError reporting, which otherwise dominates the measured loop with console I/O. - Vue route components must be defined before their createFileRoute call (bundled var hoisting silently yields component: undefined otherwise). Co-Authored-By: Claude Fable 5 <[email protected]> * ci: apply automated fixes * chore(benchmarks): prefix client-nav bench names with "client-" All benches in @benchmarks/client-nav now start with "client" so they are easy to identify on the CodSpeed dashboard (the baseline already did). Co-Authored-By: Claude Fable 5 <[email protected]> * fix(benchmarks): address review findings on client-nav scenario stability Fixes from an adversarial review of the scenario suite: - mount: create the browser history explicitly and destroy() it on unmount. The default per-router createBrowserHistory() monkey-patches window.history.pushState/replaceState, chaining one wrapper per router — per-mount cost degraded 1.8ms -> 6ms over 3000 mounts (O(N^2) drift in the cold-start bench). Verified flat (~1.86ms) after the fix. - links: replace the five <MatchRoute> components with setup-scoped useMatchRoute probes in all three apps. vue-router's MatchRoute calls useMatchRoute() inside its render function, leaking one undisposed watcher per render — the Vue bench accumulated ~5 dead subscribers per navigation. Verified flat per-tick cost over 2000 ticks after the fix. - all scenarios: bound the scroll-restoration cache with getScrollRestorationKey: (location) => location.pathname. The default key is a fresh random per-entry location key, so the module-level cache grew one entry per push navigation for the whole run. - harness hover step: dispatch a single mouseover instead of mouseover+mouseenter. Solid/Vue attach intent-preload handlers to BOTH events, so the old double dispatch ran the preload pipeline twice for them but once for React. Verified all three adapters preload exactly once per hover via cached-matches probes. - README: correct the loaders row (the invalidate step means cached routes re-run once per lap), the links row, and document the session-history growth characteristics. Co-Authored-By: Claude Fable 5 <[email protected]> * feat(benchmarks): cover client rewrites, lazy route chunks, encoded params Closes the three coverage gaps identified in the scenario-suite analysis: - new `rewrites` scenario (react/solid/vue): router basepath '/app' composed with a locale input/output rewrite pair — the client analog of the SSR rewrites scenario. Every href build runs the output rewrite and every committed location runs the input rewrite; assertions check both the internal router pathname and the external window pathname. The harness gained an `initialUrl` option since a basepath app cannot start at '/'. - route-tree-scale now builds with `autoCodeSplitting: true`, so its navigations also exercise lazy route-chunk resolution — the default shape of real file-based apps, previously uncovered. - nested-params and route-tree-scale param sets now include characters that need percent-encoding (spaces, `&`, `%`, `+`, unicode) so the segment encode/decode paths run on every navigation. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(benchmarks): reduce syscall time in measured loops, lengthen mount bench CodSpeed excludes syscall time from simulation measures, and past a threshold it warns ("cannot be consistently instrumented") and skips the benchmark; the exclusion is also inconsistent run-to-run, which was the root cause of the two same-code CI swings (route-tree-scale react 13%, async-pipeline react 3.6%) and of skipped runs on hop-heavy benches like async-pipeline solid (579 calls / 12.1ms). - Replace all counted setTimeout(0) hops with setImmediate hops (harness timerHop + async-pipeline hopDelay). Both are deterministic event-loop turns that yield to timers and the React Node scheduler, but a timer costs ~3-4 syscalls (timerfd + epoll) per hop vs ~1 for an immediate. Same-machine instrumented before/after: preload solid 39.8ms -> 1.2ms of syscall time, preload vue 30.1 -> 1.1, async-pipeline solid 23.5 -> 1.1, async-pipeline vue 17.9 -> 0.9. head/route-tree-scale are unchanged (their residual syscalls are GC/scheduler, and their measures were already stable); history's syscalls come from jsdom's internal timer-queued traversal and are not reachable from bench code (its measured values are stable regardless). - mount: 6 ticks per iteration instead of 2. A single mount simulates to only ~8ms and very short measures amplify allocator/GC quantization; the bench now measures ~50ms+ of simulated CPU. All 39 benches pass; full nx typecheck green. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(benchmarks): stop history benches sleeping in jsdom's traversal timers The history benches were skip-warned by CodSpeed for excessive syscall time (5-26ms, highly variable across runs). Root cause: jsdom delivers history traversals through two nested window.setTimeout(0) tasks, and Node clamps zero timers to 1ms of wall time — so while awaiting onRendered after back/forward/go, the event loop blocked in epoll_wait until each timer expired. That blocked wall-time is recorded as syscall time, and its duration depends on host timer behavior, hence the variability. The harness now reroutes zero-delay window.setTimeout calls onto setImmediate for the duration of a benchmark (non-zero delays pass through; clearTimeout handles both). Zero-delay timeouts carry no ordering semantics a check-phase immediate doesn't satisfy, and the suite's conventions already forbid real-delay timers in measured code. Instrumented A/A verification (2 runs per framework): history syscall time react 23-26ms -> 2.5ms, solid 14-23ms -> 1.1ms, vue 11-12ms -> 1.2ms, with bit-identical syscall counts across runs and measured values stable to 0.06%. The benches also stopped measuring sleep: locally an iteration dropped from ~42-49ms to ~5-11ms of actual CPU work. All 39 benches pass. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent a6337fb commit 208100b

627 files changed

Lines changed: 25216 additions & 13 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎benchmarks/client-nav/README.md‎

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,80 @@
11
# Client Navigation Benchmarks
22

3-
Cross-framework client-side navigation benchmarks for:
3+
Cross-framework client-side CPU benchmarks for:
44

55
- `@tanstack/react-router`
66
- `@tanstack/solid-router`
77
- `@tanstack/vue-router`
88

9+
The benchmarks run in jsdom against production builds of real apps, and are
10+
tracked in CI by CodSpeed (simulation mode).
11+
12+
> **Scope:** these benchmarks cover the standalone client router only. The
13+
> client side of TanStack Start (hydration of a server-rendered document,
14+
> streamed payload consumption, server-function calls from the client, ...) is
15+
> not covered here; the server side of Start is covered by `benchmarks/ssr`.
16+
917
## Layout
1018

11-
- `react/` - React benchmark + Vitest config
12-
- `solid/` - Solid benchmark + Vitest config
13-
- `vue/` - Vue benchmark + Vitest config
19+
- `react/`, `solid/`, `vue/` - baseline benchmark (mixed navigation loop) + Vitest config
20+
- `vitest.react.config.ts`, `vitest.solid.config.ts`, `vitest.vue.config.ts` - per-framework aggregate configs that run the baseline first, then scenario projects
21+
- `scenarios/harness.ts` - shared scenario runner (mount, link-click steps, `onRendered` synchronization)
22+
- `scenarios/<scenario>/shared.ts` - framework-agnostic scenario definition (workload data, step sequence, assertions, bench options)
23+
- `scenarios/<scenario>/<framework>/` - isolated scenario apps
24+
25+
Scenario app layout:
26+
27+
```text
28+
scenarios/<scenario>/<framework>/
29+
vite.config.ts
30+
speed.bench.ts
31+
speed.flame.ts
32+
setup.ts
33+
project.json
34+
tsconfig.json
35+
src/
36+
main.tsx
37+
routeTree.gen.ts
38+
routes/
39+
```
40+
41+
Scenario apps use file-based routing (`@tanstack/router-plugin`) with a
42+
generated `routeTree.gen.ts`, like a regular user app. Each scenario uses one
43+
app per framework instead of sharing routes in the baseline app. This keeps
44+
route-tree size and router options isolated so one scenario cannot shift
45+
another scenario's numbers. The existing baseline apps and bench names stay
46+
stable for CodSpeed continuity.
47+
48+
## Scenario Responsibilities
49+
50+
Each scenario isolates one client-side responsibility so benchmark changes can
51+
be attributed to a specific feature area.
52+
53+
| Scenario | Client-side responsibility |
54+
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
55+
| `react/`, `solid/`, `vue/` baseline apps | Mixed navigation loop: path params, search params, route context, and `useParams`/`useSearch`/`useLoaderData` selector subscriptions. |
56+
| `async-pipeline` | The router's async pipeline via counted 0ms timer hops: async loaders (transition-held navigation), async `beforeLoad` context, and parallel nested async loaders. Component-level `Await`/Suspense is excluded: React 19 throttles Suspense reveals by ~300ms wall-clock, which is inherently non-deterministic to benchmark. |
57+
| `control-flow` | Loader-thrown `redirect` (including a 2-hop chain), `notFound()` with `notFoundComponent`, loader errors with `errorComponent`, and boundary reset on recovery navigation. |
58+
| `head` | `HeadContent` per-navigation work: nested route `head()` evaluation, title/meta/link dedupe across matches, and head tag DOM updates during navigation. |
59+
| `history` | History push/replace/back/forward traversal, location masking, registered-but-never-blocking `useBlocker`, and `useCanGoBack`/`useLocation` subscriptions. |
60+
| `links` | Per-navigation cost of ~200 mounted `<Link>`s: link prop building, active-state recompute across `activeOptions` variants, `activeProps` swaps, and `useMatchRoute` probes (the `MatchRoute` component is avoided: vue-router's implementation leaks one subscription per render). |
61+
| `loaders` | Client loader dispatch: always-stale re-runs (`staleTime: 0`), cached revisits (re-run once per lap by the `invalidate` step), `loaderDeps`-keyed caching, `router.invalidate()`, and `useLoaderData` selectors. |
62+
| `mount` | Cold start: `createRouter` (route-tree processing) + first render + initial `router.load()` + unmount, with a fresh router per mount. The only scenario measuring router creation. |
63+
| `nested-params` | Deep nesting (8 dynamic levels): per-level `params.parse`/`stringify`, `beforeLoad` context accumulation across matches, and per-level `useParams`/`useRouteContext` subscriptions. Param values include characters requiring percent-encoding (as do `route-tree-scale`'s), so segment encode/decode paths run on every navigation. |
64+
| `preload` | Intent preloading from hover events, programmatic `router.preloadRoute`, deterministic preload cache behavior (`defaultPreloadStaleTime: 0`), and commit-time cache maintenance. |
65+
| `rewrites` | Composed client-side location rewrites: router `basepath` plus a locale input/output rewrite pair, running on every href build and location parse (the client analog of the SSR `rewrites` scenario). |
66+
| `route-tree-scale` | Route matching and link-target resolution on a wide (~40 route) tree mixing static, dynamic, prefixed-param, splat, pathless-layout, and route-group paths, with `autoCodeSplitting` enabled so navigations also resolve lazy route chunks. |
67+
| `search-params` | `validateSearch` execution, search middlewares (`retainSearchParams`/`stripSearchParams`), functional search updaters, structural sharing, and `useSearch` selector subscriptions. |
68+
69+
## Conventions
70+
71+
- Apps are built with `NODE_ENV=production` (`minify: false`) into `dist/app.js`; benches import the built bundle, so production package builds and production JSX output are measured, not dev transforms.
72+
- Scenarios behave like a real user app: navigation happens through `<Link>` clicks dispatched on real anchor elements (unless a scenario specifically measures the imperative API), the router uses the default browser history, and `scrollRestoration` is enabled.
73+
- Each benchmark iteration advances a fixed, circular sequence of steps; every step awaits the router's `onRendered` event, so render work is included and steps cannot overlap. No two consecutive steps may target the same location, and the sequence ends back on the initial route.
74+
- Setup runs one warm-up lap through the sequence and asserts each step's observable output (e.g. `document.title`), so a scenario that silently stops doing its work fails instead of reporting a fast time.
75+
- Determinism: no wall-clock timers (async work is resolved promises or counted `setTimeout(0)` hops), `staleTime`/`gcTime` only ever `0` or effectively-infinite, no `Math.random`/`Date.now` in the measured loop. Scroll restoration uses `getScrollRestorationKey: (location) => location.pathname` so its cache stays bounded (the default random per-entry key grows one cache entry per push navigation). The `mount` scenario opts out of `scrollRestoration` entirely and destroys its history on unmount — both register page-lifetime globals that would leak across its mount/unmount loop.
76+
- Push-only step laps grow jsdom's session-history entry list over a run (jsdom never truncates entries behind the current index). Per-push cost stays O(1) so timings are unaffected; only the `history` scenario needs — and has — a lap that is depth-stationary.
77+
- Calibration: pick per-iteration step counts so a bench's `vitest bench` run stays roughly between 8 and 30 seconds (long enough to average out, short enough for CI).
1478

1579
## Run
1680

@@ -20,23 +84,33 @@ Run all benchmarks through Nx so dependency builds are part of the graph:
2084
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf --outputStyle=stream --skipRemoteCache
2185
```
2286

23-
Run framework-specific benchmarks:
87+
Run framework-specific benchmarks (baseline + all scenarios):
2488

2589
```bash
2690
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf:react --outputStyle=stream --skipRemoteCache
2791
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf:solid --outputStyle=stream --skipRemoteCache
2892
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf:vue --outputStyle=stream --skipRemoteCache
2993
```
3094

95+
Run a single scenario app manually (after building it through Nx):
96+
97+
```bash
98+
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav-<scenario>-<framework>:build:client --outputStyle=stream --skipRemoteCache
99+
cd benchmarks/client-nav && NODE_ENV=production vitest bench --config ./scenarios/<scenario>/<framework>/vite.config.ts
100+
```
101+
31102
Run framework-specific flame benchmarks (10 second loop, profiled with `@platformatic/flame`, forced to `NODE_ENV=production`):
32103

33104
```bash
105+
# baseline
34106
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:flame:react --outputStyle=stream --skipRemoteCache
35107
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:flame:solid --outputStyle=stream --skipRemoteCache
36108
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:flame:vue --outputStyle=stream --skipRemoteCache
109+
# scenarios
110+
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav-<scenario>-<framework>:test:flame --outputStyle=stream --skipRemoteCache
37111
```
38112

39-
Typecheck benchmark sources:
113+
Typecheck benchmark sources (baseline + scenarios):
40114

41115
```bash
42116
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:types --outputStyle=stream --skipRemoteCache

‎benchmarks/client-nav/jsdom.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ setGlobal('MutationObserver', window.MutationObserver)
3030
setGlobal('sessionStorage', window.sessionStorage)
3131
setGlobal('localStorage', window.localStorage)
3232
setGlobal('getComputedStyle', window.getComputedStyle.bind(window))
33+
setGlobal('addEventListener', window.addEventListener.bind(window))
34+
setGlobal('removeEventListener', window.removeEventListener.bind(window))
35+
setGlobal('dispatchEvent', window.dispatchEvent.bind(window))
36+
setGlobal('CustomEvent', window.CustomEvent)
37+
setGlobal('Event', window.Event)
3338

3439
setGlobal(
3540
'requestAnimationFrame',
@@ -45,5 +50,6 @@ setGlobal(
4550
)
4651

4752
window.scrollTo = () => {}
53+
setGlobal('scrollTo', () => {})
4854

4955
export { window }

‎benchmarks/client-nav/package.json‎

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"test:flame:solid": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./solid/speed.flame.ts",
1111
"test:flame:vue": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./vue/speed.flame.ts",
1212
"test:perf": "NODE_ENV=production vitest bench --config ./vitest.config.ts",
13-
"test:perf:react": "NODE_ENV=production vitest bench --config ./react/vite.config.ts ./react/speed.bench.ts",
14-
"test:perf:solid": "NODE_ENV=production vitest bench --config ./solid/vite.config.ts ./solid/speed.bench.ts",
15-
"test:perf:vue": "NODE_ENV=production vitest bench --config ./vue/vite.config.ts ./vue/speed.bench.ts",
13+
"test:perf:react": "NODE_ENV=production vitest bench --config ./vitest.react.config.ts",
14+
"test:perf:solid": "NODE_ENV=production vitest bench --config ./vitest.solid.config.ts",
15+
"test:perf:vue": "NODE_ENV=production vitest bench --config ./vitest.vue.config.ts",
1616
"test:types": "pnpm run test:types:react && pnpm run test:types:solid && pnpm run test:types:vue",
1717
"test:types:react": "tsc -p ./react/tsconfig.json --noEmit",
1818
"test:types:solid": "tsc -p ./solid/tsconfig.json --noEmit",
@@ -31,6 +31,7 @@
3131
"devDependencies": {
3232
"@platformatic/flame": "^1.6.0",
3333
"@codspeed/vitest-plugin": "^5.5.0",
34+
"@tanstack/router-plugin": "workspace:^",
3435
"@testing-library/react": "^16.2.0",
3536
"@vitejs/plugin-react": "^6.0.1",
3637
"@vitejs/plugin-vue": "^6.0.5",
@@ -51,6 +52,23 @@
5152
"@tanstack/react-router"
5253
],
5354
"target": "build"
55+
},
56+
{
57+
"projects": [
58+
"@benchmarks/client-nav-async-pipeline-react",
59+
"@benchmarks/client-nav-control-flow-react",
60+
"@benchmarks/client-nav-head-react",
61+
"@benchmarks/client-nav-history-react",
62+
"@benchmarks/client-nav-links-react",
63+
"@benchmarks/client-nav-loaders-react",
64+
"@benchmarks/client-nav-mount-react",
65+
"@benchmarks/client-nav-nested-params-react",
66+
"@benchmarks/client-nav-preload-react",
67+
"@benchmarks/client-nav-rewrites-react",
68+
"@benchmarks/client-nav-route-tree-scale-react",
69+
"@benchmarks/client-nav-search-params-react"
70+
],
71+
"target": "build:client"
5472
}
5573
]
5674
},
@@ -62,6 +80,23 @@
6280
"@tanstack/solid-router"
6381
],
6482
"target": "build"
83+
},
84+
{
85+
"projects": [
86+
"@benchmarks/client-nav-async-pipeline-solid",
87+
"@benchmarks/client-nav-control-flow-solid",
88+
"@benchmarks/client-nav-head-solid",
89+
"@benchmarks/client-nav-history-solid",
90+
"@benchmarks/client-nav-links-solid",
91+
"@benchmarks/client-nav-loaders-solid",
92+
"@benchmarks/client-nav-mount-solid",
93+
"@benchmarks/client-nav-nested-params-solid",
94+
"@benchmarks/client-nav-preload-solid",
95+
"@benchmarks/client-nav-rewrites-solid",
96+
"@benchmarks/client-nav-route-tree-scale-solid",
97+
"@benchmarks/client-nav-search-params-solid"
98+
],
99+
"target": "build:client"
65100
}
66101
]
67102
},
@@ -73,6 +108,23 @@
73108
"@tanstack/vue-router"
74109
],
75110
"target": "build"
111+
},
112+
{
113+
"projects": [
114+
"@benchmarks/client-nav-async-pipeline-vue",
115+
"@benchmarks/client-nav-control-flow-vue",
116+
"@benchmarks/client-nav-head-vue",
117+
"@benchmarks/client-nav-history-vue",
118+
"@benchmarks/client-nav-links-vue",
119+
"@benchmarks/client-nav-loaders-vue",
120+
"@benchmarks/client-nav-mount-vue",
121+
"@benchmarks/client-nav-nested-params-vue",
122+
"@benchmarks/client-nav-preload-vue",
123+
"@benchmarks/client-nav-rewrites-vue",
124+
"@benchmarks/client-nav-route-tree-scale-vue",
125+
"@benchmarks/client-nav-search-params-vue"
126+
],
127+
"target": "build:client"
76128
}
77129
]
78130
},
@@ -123,7 +175,48 @@
123175
"test:types": {
124176
"cache": false,
125177
"dependsOn": [
126-
"^build"
178+
"^build",
179+
{
180+
"projects": [
181+
"@benchmarks/client-nav-async-pipeline-react",
182+
"@benchmarks/client-nav-async-pipeline-solid",
183+
"@benchmarks/client-nav-async-pipeline-vue",
184+
"@benchmarks/client-nav-control-flow-react",
185+
"@benchmarks/client-nav-control-flow-solid",
186+
"@benchmarks/client-nav-control-flow-vue",
187+
"@benchmarks/client-nav-head-react",
188+
"@benchmarks/client-nav-head-solid",
189+
"@benchmarks/client-nav-head-vue",
190+
"@benchmarks/client-nav-history-react",
191+
"@benchmarks/client-nav-history-solid",
192+
"@benchmarks/client-nav-history-vue",
193+
"@benchmarks/client-nav-links-react",
194+
"@benchmarks/client-nav-links-solid",
195+
"@benchmarks/client-nav-links-vue",
196+
"@benchmarks/client-nav-loaders-react",
197+
"@benchmarks/client-nav-loaders-solid",
198+
"@benchmarks/client-nav-loaders-vue",
199+
"@benchmarks/client-nav-mount-react",
200+
"@benchmarks/client-nav-mount-solid",
201+
"@benchmarks/client-nav-mount-vue",
202+
"@benchmarks/client-nav-nested-params-react",
203+
"@benchmarks/client-nav-nested-params-solid",
204+
"@benchmarks/client-nav-nested-params-vue",
205+
"@benchmarks/client-nav-preload-react",
206+
"@benchmarks/client-nav-preload-solid",
207+
"@benchmarks/client-nav-preload-vue",
208+
"@benchmarks/client-nav-rewrites-react",
209+
"@benchmarks/client-nav-route-tree-scale-react",
210+
"@benchmarks/client-nav-rewrites-solid",
211+
"@benchmarks/client-nav-route-tree-scale-solid",
212+
"@benchmarks/client-nav-rewrites-vue",
213+
"@benchmarks/client-nav-route-tree-scale-vue",
214+
"@benchmarks/client-nav-search-params-react",
215+
"@benchmarks/client-nav-search-params-solid",
216+
"@benchmarks/client-nav-search-params-vue"
217+
],
218+
"target": "test:types:client"
219+
}
127220
]
128221
}
129222
}

‎benchmarks/client-nav/react/vite.config.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
import { fileURLToPath } from 'node:url'
12
import { defineConfig } from 'vitest/config'
23
import react from '@vitejs/plugin-react'
34
import codspeedPlugin from '@codspeed/vitest-plugin'
45

6+
// Anchor the project root to the package directory so this config resolves
7+
// identically when run directly and as part of an aggregate `projects` config.
8+
const rootDir = fileURLToPath(new URL('..', import.meta.url))
9+
510
export default defineConfig({
11+
root: rootDir,
612
define: {
713
'process.env.NODE_ENV': JSON.stringify('production'),
814
},
@@ -25,6 +31,6 @@ export default defineConfig({
2531
name: '@benchmarks/client-nav (react)',
2632
watch: false,
2733
environment: 'jsdom',
28-
setupFiles: ['./vitest.setup.ts'],
34+
setupFiles: [`${rootDir}vitest.setup.ts`],
2935
},
3036
})

0 commit comments

Comments
 (0)