From 66c1dcf64c8226fd04e65f0227e055fd04a9e58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=83=E4=B9=98=E5=A6=8D=20=28Xiaoyaner=29?= <258399167+xiaoyaner0201@users.noreply.github.com> Date: Fri, 23 Oct 2026 04:28:14 +0800 Subject: [PATCH] fix(web): keep docs integration test outside production build inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the collector example test alongside existing root-level web tests so the web-only Docker context does not require repository documentation. Preserve all assertions and default Vitest discovery; document the boundary. Verified 1217 tests, focused 12 tests, typecheck, lint, build and a fresh web-only build without repository docs. Original snapshot reproduced TS2307. Independent review passed. Full local image build was blocked by an uncached pnpm download with network disabled; remote image CI remains authoritative. Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com> --- docs/frontend-analytics.md | 6 ++++++ web/{src/app => }/analytics-example.test.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) rename web/{src/app => }/analytics-example.test.ts (98%) diff --git a/docs/frontend-analytics.md b/docs/frontend-analytics.md index eb98ad167..f84d14803 100644 --- a/docs/frontend-analytics.md +++ b/docs/frontend-analytics.md @@ -154,6 +154,12 @@ and the returned function removes listeners. It catches callback errors and neve calls preventDefault/stopPropagation. Tests use synthetic data and are not browser or deployment acceptance. +The repository-integration test lives at `web/analytics-example.test.ts`, alongside +the existing root-level web tests. Vitest discovers it with `pnpm -C web test`; +run it alone with `pnpm -C web test analytics-example.test.ts`. It stays outside +the production TypeScript project's `src`/`test` inputs because the docs-only +example is not present in the `web/` Docker build context. + ## Optional deployment-owned Nginx injection Prefer a separately maintained same-origin HTTPS module, optionally inserted by diff --git a/web/src/app/analytics-example.test.ts b/web/analytics-example.test.ts similarity index 98% rename from web/src/app/analytics-example.test.ts rename to web/analytics-example.test.ts index 76aeabb3b..264d76794 100644 --- a/web/src/app/analytics-example.test.ts +++ b/web/analytics-example.test.ts @@ -1,7 +1,7 @@ /** @vitest-environment jsdom */ import { afterEach, describe, expect, it, vi } from 'vitest' import { fireEvent } from '@testing-library/react' -import { observeSkillhubIntents } from '../../../docs/examples/skillhub-intents.mjs' +import { observeSkillhubIntents } from '../docs/examples/skillhub-intents.mjs' const stops: Array<() => void> = [] afterEach(() => { stops.splice(0).forEach(stop => stop()); document.body.replaceChildren(); vi.restoreAllMocks(); vi.unstubAllGlobals() })