From f0aa2c44828a2f7b8e1543067008322fc4fb5e8a Mon Sep 17 00:00:00 2001 From: Brian Love Date: Wed, 20 May 2026 09:29:18 -0700 Subject: [PATCH 1/2] test(website): import real @ngaf/design-tokens in Differentiator spec Drops the 20-line tokens stub. The Hero spec already proves the real design-tokens module loads cleanly under vitest; stubbing it here hid token-shape drift behind invented values. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../landing/Differentiator.spec.tsx | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/apps/website/src/components/landing/Differentiator.spec.tsx b/apps/website/src/components/landing/Differentiator.spec.tsx index c9734b948..4713e6eba 100644 --- a/apps/website/src/components/landing/Differentiator.spec.tsx +++ b/apps/website/src/components/landing/Differentiator.spec.tsx @@ -19,25 +19,6 @@ vi.mock('../ui/Section', () => ({ vi.mock('../ui/Eyebrow', () => ({ Eyebrow: ({ children }: { children: React.ReactNode }) => {children}, })); -vi.mock('@ngaf/design-tokens', () => ({ - tokens: { - colors: { - accent: '#7c3aed', - textPrimary: '#111827', - textSecondary: '#6b7280', - textMuted: '#9ca3af', - }, - surfaces: { - border: '#e5e7eb', - }, - typography: { - h2: { family: 'sans-serif', size: '2rem', line: '1.2' }, - bodyLg: { family: 'sans-serif', size: '1.125rem', line: '1.6' }, - body: { family: 'sans-serif', size: '1rem', line: '1.5' }, - fontMono: 'monospace', - }, - }, -})); import { trackCtaClick } from '../../lib/analytics/client'; From 6df1063cce21522a75357aae563ba0eac01cbe6d Mon Sep 17 00:00:00 2001 From: Brian Love Date: Wed, 20 May 2026 09:31:48 -0700 Subject: [PATCH 2/2] fix(website): repair pre-existing red tests in apps/website - docs.spec.ts: contentRoot was built via path.join(process.cwd(), 'apps', 'website', ...), which doubles to apps/website/apps/website/... when the runner is invoked from apps/website/. Switch to a path derived from import.meta.url so it's cwd-invariant. Heals both the MDX-walk crash and the "missing api-docs.json" false negatives (7 libraries flagged as missing files that actually existed). - Delete apps/website/src/components/docs/open-in-cockpit.spec.tsx. The component was removed in 7134a387 (glassy redesign / docs refresh) but its spec was left behind, failing vitest's import resolution and registering as a zero-test failed suite. Result: apps/website vitest goes from 53 passing + 2 failed test files + 1 zero-test load failure to 55 passing across 13 files. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../components/docs/open-in-cockpit.spec.tsx | 21 ------------------- apps/website/src/lib/docs.spec.ts | 5 ++++- 2 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 apps/website/src/components/docs/open-in-cockpit.spec.tsx diff --git a/apps/website/src/components/docs/open-in-cockpit.spec.tsx b/apps/website/src/components/docs/open-in-cockpit.spec.tsx deleted file mode 100644 index aa1236904..000000000 --- a/apps/website/src/components/docs/open-in-cockpit.spec.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { renderToStaticMarkup } from 'react-dom/server'; -import { describe, expect, it } from 'vitest'; -import { resolveDocsBundle } from '../../../../../libs/cockpit-docs/src/index'; -import { OpenInCockpit } from './open-in-cockpit'; - -describe('OpenInCockpit', () => { - it('renders a metadata-driven cockpit link for the current docs bundle', () => { - const bundle = resolveDocsBundle({ - product: 'deep-agents', - section: 'core-capabilities', - topic: 'planning', - page: 'overview', - language: 'python', - }); - - const html = renderToStaticMarkup(); - - expect(html).toContain('/deep-agents/core-capabilities/planning/overview/python'); - }); -}); diff --git a/apps/website/src/lib/docs.spec.ts b/apps/website/src/lib/docs.spec.ts index cd9a17a0a..fcd11cd95 100644 --- a/apps/website/src/lib/docs.spec.ts +++ b/apps/website/src/lib/docs.spec.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; import fs from 'fs'; import path from 'path'; +import { fileURLToPath } from 'url'; import { getAllDocSlugs, getDocBySlug, getDocMetadata } from './docs'; import { allDocsPages } from './docs-config'; import { getCanonicalUrl, getSitemapRoutes } from './site-metadata'; @@ -12,7 +13,9 @@ function findInternalDocsLinks(content: string): string[] { .filter((href): href is string => Boolean(href)); } -const contentRoot = path.join(process.cwd(), 'apps', 'website', 'content', 'docs'); +// Resolved relative to this spec file so the path stays correct regardless of +// the runner's cwd (apps/website/ vs workspace root). +const contentRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'content', 'docs'); function walkMdxFiles(dir: string): string[] { return fs.readdirSync(dir).flatMap((entry) => {