fix(web): keep docs integration test outside production build inputs

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>
This commit is contained in:
千乘妍 (Xiaoyaner) 2026-10-23 04:28:14 +08:00
parent b284653f29
commit 66c1dcf64c
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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() })