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