#!/usr/bin/env node import { dirname, join } from 'node:path' import { fileURLToPath } from 'node:url' import { runSuite } from '../../shared/run-suite.ts' import { onlyProductionPages } from '../utils/production-pages.ts' import { resolveAllDocsPages, resolveDocsScope } from '../utils/resolve-docs-scope.ts' const DEFAULT_BASE_URL = 'http://localhost:3001' // Playwright inherits this, so the a11y failures reporter lists the guides it skipped as unchecked. // Cleared first, so a value from the shell can't mark scanned guides unchecked. process.env.DOCS_E2E_SKIPPED_PAGES = '' runSuite({ root: join(dirname(fileURLToPath(import.meta.url)), '..'), label: 'docs', devCommand: 'pnpm dev:docs', pagePathsEnv: 'DOCS_E2E_PAGE_PATHS', baseRefEnv: 'DOCS_E2E_BASE_REF', defaultBaseUrl: DEFAULT_BASE_URL, resolveScope: resolveDocsScope, resolveAllPages: async (repoRoot) => { const pages = await resolveAllDocsPages(repoRoot) if (!process.env.DOCS_E2E_DEPLOYED_ONLY) return pages const baseUrl = process.env.PLAYWRIGHT_BASE_URL?.trim() || DEFAULT_BASE_URL const { live, notOnProduction } = await onlyProductionPages( pages, new URL('/docs/sitemap.xml', baseUrl).href ) process.env.DOCS_E2E_SKIPPED_PAGES = notOnProduction.join(',') return live }, }).catch((error) => { console.error(error instanceof Error ? error.message : error) process.exit(1) })