@storywright/cli 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -291,10 +291,6 @@ function formatSummary(summary, options) {
291
291
  lines.push(" Failed:");
292
292
  for (const failure of diffFailures) {
293
293
  lines.push(` \u2717 ${failure.story}: ${failure.variant} (${failure.browser})`);
294
- if (failure.diffRatio > 0) {
295
- const pct = (failure.diffRatio * 100).toFixed(1);
296
- lines.push(` \u2192 Diff: ${pct}% pixels changed`);
297
- }
298
294
  }
299
295
  }
300
296
  const reportPath = options?.reportPath ?? ".storywright/report/index.html";
@@ -527,7 +523,7 @@ test.describe.parallel('visual regression testing', () => {
527
523
  }
528
524
 
529
525
  for (const story of Object.values(targetList.entries)) {
530
- test(\`\${story.title}: \${story.name}\`, async ({ page }) => {
526
+ test(\`\${story.title}: \${story.name}\`, async ({ page }, testInfo) => {
531
527
  await initPage(page, stabilizeOptions);
532
528
 
533
529
  await page.goto(\`/iframe.html?id=\${story.id}\`, {
@@ -536,15 +532,29 @@ test.describe.parallel('visual regression testing', () => {
536
532
 
537
533
  await stabilizePage(page, stabilizeOptions);
538
534
 
539
- await expect(page).toHaveScreenshot(
540
- [story.title, \`\${story.id}.png\`],
541
- {
542
- animations: '${config.animations}',
543
- fullPage: ${config.fullPage},
544
- threshold: ${config.threshold},
545
- maxDiffPixelRatio: ${config.maxDiffPixelRatio},
546
- },
547
- );
535
+ try {
536
+ await expect(page).toHaveScreenshot(
537
+ [story.title, \`\${story.id}.png\`],
538
+ {
539
+ animations: '${config.animations}',
540
+ fullPage: ${config.fullPage},
541
+ threshold: ${config.threshold},
542
+ maxDiffPixelRatio: ${config.maxDiffPixelRatio},
543
+ },
544
+ );
545
+ } catch (error) {
546
+ // When baseline is missing, Playwright skips screenshot capture entirely.
547
+ // Capture one here so the report can show what the new story looks like.
548
+ if (!testInfo.attachments.some(a => a.name.includes('-actual'))) {
549
+ try {
550
+ const screenshot = await page.screenshot({ fullPage: ${config.fullPage} });
551
+ await testInfo.attach(\`\${story.id}-actual\`, { body: screenshot, contentType: 'image/png' });
552
+ } catch {
553
+ // ignore \u2014 best effort
554
+ }
555
+ }
556
+ throw error;
557
+ }
548
558
  });
549
559
  }
550
560
  });
@@ -1067,4 +1077,4 @@ export {
1067
1077
  detectCIContext,
1068
1078
  runNotifiers
1069
1079
  };
1070
- //# sourceMappingURL=chunk-LTWFZFDB.js.map
1080
+ //# sourceMappingURL=chunk-U4SVAJV4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/index.ts","../src/config/defaults.ts","../src/config/types.ts","../src/notifier/report-url.ts","../src/notifier/ci-context.ts","../src/utils/logger.ts","../src/notifier/runner.ts","../src/reporter/cli-reporter.ts","../src/storage/local.ts","../src/storage/index.ts","../src/core/engine.ts","../src/playwright/config-generator.ts","../src/playwright/test-generator.ts","../src/resolver/index.ts","../src/utils/path.ts","../src/utils/process.ts","../src/core/storybook.ts"],"sourcesContent":["import { loadConfig as unconfigLoad } from \"unconfig\";\nimport { DEFAULT_CONFIG } from \"./defaults.js\";\nimport { STANDARD_BROWSERS } from \"./types.js\";\nimport type { DeepPartial, StorywrightConfig } from \"./types.js\";\n\nexport function defineConfig(\n config: DeepPartial<StorywrightConfig>,\n): DeepPartial<StorywrightConfig> {\n return config;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction deepMerge(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = { ...target };\n for (const key of Object.keys(source)) {\n const sourceVal = source[key];\n const targetVal = result[key];\n if (isPlainObject(sourceVal) && isPlainObject(targetVal)) {\n result[key] = deepMerge(targetVal, sourceVal);\n } else if (sourceVal !== undefined) {\n result[key] = sourceVal;\n }\n }\n return result;\n}\n\nexport async function loadConfig(\n cwd: string = process.cwd(),\n overrides?: DeepPartial<StorywrightConfig>,\n): Promise<StorywrightConfig> {\n const { config: userConfig } = await unconfigLoad<DeepPartial<StorywrightConfig>>({\n sources: [\n {\n files: \"storywright.config\",\n extensions: [\"ts\", \"js\", \"mjs\"],\n },\n ],\n cwd,\n });\n\n let merged = DEFAULT_CONFIG as unknown as Record<string, unknown>;\n if (userConfig) {\n merged = deepMerge(merged, userConfig as Record<string, unknown>);\n }\n if (overrides) {\n merged = deepMerge(merged, overrides as Record<string, unknown>);\n }\n const result = merged as unknown as StorywrightConfig;\n validateConfig(result);\n return result;\n}\n\nfunction validateConfig(config: StorywrightConfig): void {\n for (const browser of config.browsers) {\n const options = config.browserOptions[browser];\n\n if (!STANDARD_BROWSERS.has(browser) && !options?.browserName) {\n throw new Error(\n `Custom browser project '${browser}' requires 'browserName' in browserOptions.\\nExample:\\n browserOptions: {\\n '${browser}': { browserName: 'webkit', ... }\\n }\\nValid browserName values: 'chromium', 'firefox', 'webkit'.\\n\\nError code: SW_E_MISSING_BROWSER_NAME`,\n );\n }\n\n if (options?.browserName && !STANDARD_BROWSERS.has(options.browserName)) {\n throw new Error(\n `Invalid browserName '${options.browserName}' for browser project '${browser}'.\\nValid values: 'chromium', 'firefox', 'webkit'.\\n\\nError code: SW_E_INVALID_BROWSER_NAME`,\n );\n }\n }\n}\n\nexport type { StorywrightConfig, DeepPartial } from \"./types.js\";\n","import type { StorywrightConfig } from \"./types.js\";\n\nexport const DEFAULT_CONFIG: StorywrightConfig = {\n storybook: {\n staticDir: \"storybook-static\",\n buildCommand: \"npx storybook build --stats-json\",\n url: undefined,\n compatibility: \"auto\",\n },\n\n browsers: [\"chromium\"],\n browserOptions: {},\n\n screenshot: {\n fullPage: true,\n animations: \"disabled\",\n threshold: 0.02,\n maxDiffPixelRatio: 0.02,\n freezeTime: \"2024-01-01T00:00:00\",\n timezone: \"UTC\",\n locale: \"en-US\",\n seed: 1,\n },\n\n diffDetection: {\n enabled: true,\n watchFiles: [\"package.json\", \"package-lock.json\", \".storybook/**/*\"],\n baseBranch: \"main\",\n baseBranchDiffDepth: 1,\n },\n\n storage: {\n provider: \"local\",\n branch: \"main\",\n local: {\n baselineDir: \".storywright/baselines\",\n },\n s3: {\n bucket: \"\",\n prefix: \"storywright/baselines\",\n region: \"ap-northeast-1\",\n compression: \"zstd\",\n },\n },\n\n report: {\n outputDir: \".storywright/report\",\n title: \"Storywright Report\",\n },\n\n workers: \"auto\",\n retries: 0,\n\n timeout: {\n test: 30000,\n navigation: 20000,\n expect: 10000,\n },\n\n include: [\"**\"],\n exclude: [],\n\n hooks: {},\n\n notifiers: [],\n};\n","import type { Page } from \"@playwright/test\";\nimport type { Notifier } from \"../notifier/types.js\";\n\nexport interface StorywrightConfig {\n storybook: StorybookConfig;\n browsers: BrowserName[];\n browserOptions: Record<string, BrowserOption>;\n screenshot: ScreenshotConfig;\n diffDetection: DiffDetectionConfig;\n storage: StorageConfig;\n report: ReportConfig;\n workers: number | \"auto\";\n retries: number;\n timeout: TimeoutConfig;\n include: string[];\n exclude: string[];\n hooks: HooksConfig;\n notifiers: Notifier[];\n}\n\nexport type BrowserName = \"chromium\" | \"firefox\" | \"webkit\" | (string & {});\n\nexport type PlaywrightBrowserName = \"chromium\" | \"firefox\" | \"webkit\";\n\nexport const STANDARD_BROWSERS: ReadonlySet<string> = new Set<PlaywrightBrowserName>([\n \"chromium\",\n \"firefox\",\n \"webkit\",\n]);\n\nexport interface BrowserOption {\n browserName?: PlaywrightBrowserName;\n viewport?: { width: number; height: number };\n deviceScaleFactor?: number;\n isMobile?: boolean;\n hasTouch?: boolean;\n userAgent?: string;\n exclude?: string[];\n}\n\nexport interface StorybookConfig {\n staticDir: string;\n buildCommand: string;\n url?: string;\n compatibility: \"auto\" | \"v8\";\n}\n\nexport interface ScreenshotConfig {\n fullPage: boolean;\n animations: \"disabled\" | \"allow\";\n threshold: number;\n maxDiffPixelRatio: number;\n freezeTime: string;\n timezone: string;\n locale: string;\n seed: number;\n}\n\nexport interface DiffDetectionConfig {\n enabled: boolean;\n watchFiles: string[];\n baseBranch: string;\n baseBranchDiffDepth: number;\n}\n\nexport interface StorageConfig {\n provider: \"local\" | \"s3\";\n branch: string;\n local: LocalStorageConfig;\n s3: S3StorageConfig;\n}\n\nexport interface LocalStorageConfig {\n baselineDir: string;\n}\n\nexport interface S3StorageConfig {\n bucket: string;\n prefix: string;\n region: string;\n compression: \"zstd\" | \"gzip\" | \"none\";\n}\n\nexport interface ReportConfig {\n outputDir: string;\n title: string;\n url?: string;\n}\n\nexport interface TimeoutConfig {\n test: number;\n navigation: number;\n expect: number;\n}\n\nexport interface StoryContext {\n id: string;\n title: string;\n name: string;\n}\n\nexport interface HooksConfig {\n beforeScreenshot?: (page: Page, story: StoryContext) => Promise<void>;\n afterScreenshot?: (page: Page, story: StoryContext) => Promise<void>;\n}\n\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n","export interface ReportUrlContext {\n prNumber?: number;\n branch: string;\n sha: string;\n shortSha: string;\n timestamp: string;\n}\n\nexport function resolveReportUrl(template: string, ctx: ReportUrlContext): string {\n return template\n .replace(/\\$\\{prNumber\\}/g, ctx.prNumber != null ? String(ctx.prNumber) : \"\")\n .replace(/\\$\\{branch\\}/g, encodeURIComponent(ctx.branch))\n .replace(/\\$\\{sha\\}/g, ctx.sha)\n .replace(/\\$\\{shortSha\\}/g, ctx.shortSha)\n .replace(/\\$\\{timestamp\\}/g, ctx.timestamp);\n}\n","import { execSync } from \"node:child_process\";\n\nexport interface CIContext {\n provider: \"github-actions\" | \"circleci\" | \"generic\" | \"local\";\n prNumber?: number;\n branch: string;\n sha: string;\n shortSha: string;\n timestamp: string;\n repository?: string;\n token?: string;\n}\n\nexport interface CIContextOverrides {\n prNumber?: number;\n branch?: string;\n sha?: string;\n repository?: string;\n token?: string;\n}\n\nexport function detectCIContext(overrides?: CIContextOverrides): CIContext {\n const base = detectFromEnvironment();\n\n const sha = overrides?.sha ?? base.sha;\n return {\n ...base,\n ...stripUndefined(overrides),\n sha,\n shortSha: sha.slice(0, 7),\n };\n}\n\nfunction detectFromEnvironment(): CIContext {\n const timestamp = formatTimestamp(new Date());\n\n if (process.env.GITHUB_ACTIONS) {\n return {\n provider: \"github-actions\",\n token: process.env.GITHUB_TOKEN,\n repository: process.env.GITHUB_REPOSITORY,\n prNumber: extractPrFromGitHubRef(process.env.GITHUB_REF),\n branch: process.env.GITHUB_HEAD_REF || gitBranch(),\n sha: process.env.GITHUB_SHA || gitSha(),\n shortSha: (process.env.GITHUB_SHA || gitSha()).slice(0, 7),\n timestamp,\n };\n }\n\n if (process.env.CIRCLECI) {\n return {\n provider: \"circleci\",\n token: process.env.GITHUB_TOKEN,\n repository: buildCircleCIRepository(),\n prNumber: extractPrFromUrl(process.env.CIRCLE_PULL_REQUEST),\n branch: process.env.CIRCLE_BRANCH || gitBranch(),\n sha: process.env.CIRCLE_SHA1 || gitSha(),\n shortSha: (process.env.CIRCLE_SHA1 || gitSha()).slice(0, 7),\n timestamp,\n };\n }\n\n if (process.env.STORYWRIGHT_PR_NUMBER) {\n return {\n provider: \"generic\",\n token: process.env.STORYWRIGHT_GITHUB_TOKEN,\n repository: process.env.STORYWRIGHT_GITHUB_REPO,\n prNumber: Number(process.env.STORYWRIGHT_PR_NUMBER),\n branch: gitBranch(),\n sha: gitSha(),\n shortSha: gitSha().slice(0, 7),\n timestamp,\n };\n }\n\n return {\n provider: \"local\",\n branch: gitBranch(),\n sha: gitSha(),\n shortSha: gitSha().slice(0, 7),\n timestamp,\n };\n}\n\nexport function extractPrFromGitHubRef(ref?: string): number | undefined {\n if (!ref) return undefined;\n const match = ref.match(/^refs\\/pull\\/(\\d+)\\//);\n return match ? Number(match[1]) : undefined;\n}\n\nexport function extractPrFromUrl(url?: string): number | undefined {\n if (!url) return undefined;\n const match = url.match(/\\/pull\\/(\\d+)/);\n return match ? Number(match[1]) : undefined;\n}\n\nfunction buildCircleCIRepository(): string | undefined {\n const user = process.env.CIRCLE_PROJECT_USERNAME;\n const repo = process.env.CIRCLE_PROJECT_REPONAME;\n return user && repo ? `${user}/${repo}` : undefined;\n}\n\nfunction gitBranch(): string {\n try {\n return execSync(\"git branch --show-current\", { encoding: \"utf-8\" }).trim();\n } catch {\n return \"unknown\";\n }\n}\n\nfunction gitSha(): string {\n try {\n return execSync(\"git rev-parse HEAD\", { encoding: \"utf-8\" }).trim();\n } catch {\n return \"0000000000000000000000000000000000000000\";\n }\n}\n\nfunction formatTimestamp(date: Date): string {\n return date\n .toISOString()\n .replace(/[-:]/g, \"\")\n .replace(/\\.\\d+Z$/, \"\");\n}\n\nfunction stripUndefined(obj?: CIContextOverrides): Partial<CIContext> {\n if (!obj) return {};\n const result: Partial<CIContext> = {};\n if (obj.prNumber !== undefined) result.prNumber = obj.prNumber;\n if (obj.branch !== undefined) result.branch = obj.branch;\n if (obj.sha !== undefined) result.sha = obj.sha;\n if (obj.repository !== undefined) result.repository = obj.repository;\n if (obj.token !== undefined) result.token = obj.token;\n return result;\n}\n","import { createConsola } from \"consola\";\n\nconst isCI = !!(\n process.env.CI ||\n process.env.GITHUB_ACTIONS ||\n process.env.CIRCLECI ||\n process.env.GITLAB_CI\n);\n\nexport const logger = createConsola({\n level: process.env.STORYWRIGHT_DEBUG ? 5 : 3,\n});\n\nexport { isCI };\n","import { logger } from \"../utils/logger.js\";\nimport type { NotificationContext, Notifier } from \"./types.js\";\n\nexport async function runNotifiers(\n notifiers: Notifier[],\n context: NotificationContext,\n): Promise<void> {\n for (const notifier of notifiers) {\n try {\n const result = await notifier.notify(context);\n if (result.posted) {\n logger.success(`Notification sent: ${notifier.name}`);\n } else if (result.skipped) {\n logger.info(`Notification skipped: ${notifier.name} (${result.skipped})`);\n }\n } catch (error) {\n logger.warn(\n `Notification failed: ${notifier.name}`,\n error instanceof Error ? error.message : error,\n );\n }\n }\n}\n","import type { TestSummary } from \"../core/types.js\";\n\nexport function formatSummary(summary: TestSummary, options?: { reportPath?: string }): string {\n const durationSec = Math.round(summary.duration / 1000);\n const minutes = Math.floor(durationSec / 60);\n const seconds = durationSec % 60;\n const durationStr = minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;\n\n const lines: string[] = [\n \"\",\n \"Storywright Results\",\n \"\\u2550\".repeat(42),\n ` Total: ${summary.total} Passed: ${summary.passed} Failed: ${summary.failed} Skipped: ${summary.skipped}`,\n ` Duration: ${durationStr}`,\n ` Browsers: ${summary.browsers.join(\", \")}`,\n ];\n\n const newFailures = summary.entries.filter((f) => f.type === \"new\");\n const diffFailures = summary.entries.filter((f) => f.type === \"diff\");\n\n if (newFailures.length > 0) {\n lines.push(\"\");\n lines.push(\" New (no baseline):\");\n for (const failure of newFailures) {\n lines.push(` \\u25cb ${failure.story}: ${failure.variant} (${failure.browser})`);\n }\n }\n\n if (diffFailures.length > 0) {\n lines.push(\"\");\n lines.push(\" Failed:\");\n for (const failure of diffFailures) {\n lines.push(` \\u2717 ${failure.story}: ${failure.variant} (${failure.browser})`);\n }\n }\n\n const reportPath = options?.reportPath ?? \".storywright/report/index.html\";\n lines.push(\"\");\n lines.push(` Report: ${reportPath}`);\n lines.push(\"\\u2550\".repeat(42));\n lines.push(\"\");\n\n return lines.join(\"\\n\");\n}\n","import { execFile } from \"node:child_process\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { promisify } from \"node:util\";\nimport type { DownloadOptions, StorageAdapter, UploadOptions } from \"./types.js\";\n\nconst execFileAsync = promisify(execFile);\n\nexport class LocalStorageAdapter implements StorageAdapter {\n constructor(private readonly baselineDir: string) {}\n\n async download(options: DownloadOptions): Promise<void> {\n try {\n await fs.access(this.baselineDir);\n } catch {\n return;\n }\n await fs.cp(this.baselineDir, options.destDir, { recursive: true });\n }\n\n async upload(options: UploadOptions): Promise<void> {\n const resolvedSource = path.resolve(options.sourceDir);\n const resolvedDest = path.resolve(this.baselineDir);\n if (resolvedSource === resolvedDest) {\n return;\n }\n await fs.mkdir(this.baselineDir, { recursive: true });\n await fs.cp(options.sourceDir, this.baselineDir, { recursive: true });\n }\n\n async exists(_branch: string): Promise<boolean> {\n try {\n await fs.access(this.baselineDir);\n const entries = await fs.readdir(this.baselineDir);\n return entries.length > 0;\n } catch {\n return false;\n }\n }\n\n /**\n * Extract baselines from a git branch using `git ls-tree` + `git show`.\n * Binary-safe (PNG files) via `encoding: 'buffer'`.\n */\n async downloadFromGit(branch: string, destDir: string, cwd: string): Promise<void> {\n const gitPath = this.baselineDir.split(path.sep).join(\"/\");\n\n let lsOutput: string;\n try {\n const result = await execFileAsync(\n \"git\",\n [\"ls-tree\", \"-r\", \"--name-only\", branch, \"--\", gitPath],\n { cwd },\n );\n lsOutput = result.stdout;\n } catch (error) {\n throw new Error(\n `Failed to list baselines from git branch '${branch}': ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n const files = lsOutput.trim().split(\"\\n\").filter(Boolean);\n if (files.length === 0) {\n return;\n }\n\n await fs.mkdir(destDir, { recursive: true });\n\n const posixBaselineDir = this.baselineDir.split(path.sep).join(\"/\").replace(/\\/+$/, \"\");\n\n for (const file of files) {\n let content: Buffer;\n try {\n const result = await execFileAsync(\"git\", [\"show\", `${branch}:${file}`], {\n cwd,\n encoding: \"buffer\" as unknown as BufferEncoding,\n maxBuffer: 50 * 1024 * 1024,\n });\n content = result.stdout as unknown as Buffer;\n } catch (error) {\n throw new Error(\n `Failed to extract '${file}' from git branch '${branch}': ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n const relativePath = file.slice(posixBaselineDir.length + 1);\n const destPath = path.join(destDir, ...relativePath.split(\"/\"));\n await fs.mkdir(path.dirname(destPath), { recursive: true });\n await fs.writeFile(destPath, content);\n }\n }\n}\n","import type { StorageConfig } from \"../config/types.js\";\nimport { LocalStorageAdapter } from \"./local.js\";\nimport type { StorageAdapter } from \"./types.js\";\n\nexport async function createStorageAdapter(config: StorageConfig): Promise<StorageAdapter> {\n switch (config.provider) {\n case \"local\":\n return new LocalStorageAdapter(config.local.baselineDir);\n case \"s3\":\n return await loadS3Adapter(config);\n default:\n throw new Error(`Unknown storage provider: ${String(config.provider)}`);\n }\n}\n\nasync function loadS3Adapter(config: StorageConfig): Promise<StorageAdapter> {\n try {\n const { S3StorageAdapter } = await import(\"@storywright/storage-s3\");\n return new S3StorageAdapter(config.s3) as StorageAdapter;\n } catch {\n throw new Error(\n \"S3 storage adapter requires the @storywright/storage-s3 package.\\nInstall it with: pnpm add @storywright/storage-s3\",\n );\n }\n}\n\nexport type { StorageAdapter, DownloadOptions, UploadOptions } from \"./types.js\";\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport type { StorywrightConfig } from \"../config/types.js\";\nimport { generatePlaywrightConfig } from \"../playwright/config-generator.js\";\nimport { generateTestFile } from \"../playwright/test-generator.js\";\nimport { resolveAffectedStories } from \"../resolver/index.js\";\nimport { createStorageAdapter } from \"../storage/index.js\";\nimport { logger } from \"../utils/logger.js\";\nimport { resolveOutputDir } from \"../utils/path.js\";\nimport { exec } from \"../utils/process.js\";\nimport {\n buildStorybook,\n discoverStories,\n excludeStoriesForBrowser,\n filterStories,\n} from \"./storybook.js\";\nimport type { Story, StoryIndex, TestSummary } from \"./types.js\";\n\nexport interface TestOptions {\n diffOnly?: boolean;\n shard?: string;\n updateSnapshots?: boolean;\n filter?: string;\n outputDir?: string;\n reporters?: string[];\n}\n\nexport interface TestRunResult {\n exitCode: number;\n summary?: TestSummary;\n reportDir?: string;\n snapshotDir?: string;\n}\n\nconst STORIES_PER_FILE = 50;\n\nfunction resolveReporterPath(): string {\n // Resolve relative to this file's dist location\n const thisDir = new URL(\".\", import.meta.url).pathname;\n return path.resolve(thisDir, \"playwright\", \"reporter.js\");\n}\n\nfunction chunkStories(entries: Record<string, Story>): Record<string, Story>[] {\n const keys = Object.keys(entries);\n if (keys.length === 0) return [{}];\n const chunks: Record<string, Story>[] = [];\n for (let i = 0; i < keys.length; i += STORIES_PER_FILE) {\n const chunk: Record<string, Story> = {};\n for (const key of keys.slice(i, i + STORIES_PER_FILE)) {\n chunk[key] = entries[key];\n }\n chunks.push(chunk);\n }\n return chunks;\n}\n\nexport async function runTests(\n config: StorywrightConfig,\n options: TestOptions = {},\n cwd: string = process.cwd(),\n): Promise<TestRunResult> {\n const outputRoot = options.outputDir\n ? path.resolve(cwd, options.outputDir)\n : resolveOutputDir(cwd, \".storywright\");\n const tmpDir = path.join(outputRoot, \"tmp\");\n const reportDir = options.outputDir\n ? path.join(outputRoot, \"report\")\n : path.resolve(cwd, config.report.outputDir);\n const storybookDir = path.resolve(cwd, config.storybook.staticDir);\n const snapshotDir = path.join(tmpDir, \"snapshots\");\n\n // Prepare directories early for parallel operations\n await fs.mkdir(snapshotDir, { recursive: true });\n\n // Start baseline download in parallel with Storybook build\n // Skip download when updating snapshots (update command) — baselines are regenerated\n let baselinePromise: Promise<void> | undefined;\n if (!options.updateSnapshots) {\n const storage = await createStorageAdapter(config.storage);\n baselinePromise = storage\n .download({\n branch: config.storage.branch,\n destDir: snapshotDir,\n onProgress: (msg) => logger.info(msg),\n })\n .catch(() => {\n logger.info(\"No existing baselines found\");\n });\n }\n\n // 1. Build Storybook if needed\n await buildStorybook(config, cwd);\n\n // 2. Discover & filter stories\n logger.start(\"Discovering stories...\");\n const allStories = await discoverStories(config, cwd);\n let targetStories = filterStories(allStories, config);\n\n // Apply --filter option\n if (options.filter) {\n targetStories = applyFilter(targetStories, options.filter);\n }\n\n logger.info(`${Object.keys(targetStories.entries).length} stories found`);\n\n // 3. Diff-only: resolve affected stories (default in CI)\n const effectiveDiffOnly = options.diffOnly ?? !!process.env.CI;\n if (effectiveDiffOnly && config.diffDetection.enabled) {\n logger.start(\"Resolving dependencies...\");\n const diffResult = await resolveAffectedStories(\n targetStories,\n config.diffDetection,\n storybookDir,\n cwd,\n );\n if (!diffResult.allStories) {\n targetStories = diffResult.targetStories;\n }\n logger.info(`${Object.keys(targetStories.entries).length} stories affected by changes`);\n }\n\n // 4. Wait for baseline download to complete\n await baselinePromise;\n\n // 5. Generate split test files for better worker distribution\n let testFilePattern: string;\n let testMatchByBrowser: Record<string, string> | undefined;\n\n const browserExcludesExist = config.browsers.some(\n (b) => (config.browserOptions[b]?.exclude ?? []).length > 0,\n );\n\n if (browserExcludesExist) {\n // Generate per-browser test files when any browser has specific excludes\n testMatchByBrowser = {};\n\n for (const browser of config.browsers) {\n const browserExclude = config.browserOptions[browser]?.exclude ?? [];\n const browserStories = excludeStoriesForBrowser(targetStories, browserExclude);\n\n if (Object.keys(browserStories.entries).length === 0) {\n logger.warn(\n `${browser}: All stories excluded by browser-specific 'exclude' patterns. No tests will run for this browser.`,\n );\n }\n\n const browserChunks = chunkStories(browserStories.entries);\n\n testMatchByBrowser[browser] =\n browserChunks.length === 1\n ? `storywright-${browser}-0.spec.ts`\n : `storywright-${browser}-*.spec.ts`;\n\n for (let i = 0; i < browserChunks.length; i++) {\n const chunkIndex: StoryIndex = {\n ...browserStories,\n entries: browserChunks[i],\n };\n const chunkPath = path.join(tmpDir, `target-stories-${browser}-${i}.json`);\n await fs.writeFile(chunkPath, JSON.stringify(chunkIndex));\n\n const testContent = generateTestFile(config.screenshot, {\n targetStoriesPath: chunkPath.replace(/\\\\/g, \"/\"),\n });\n await fs.writeFile(path.join(tmpDir, `storywright-${browser}-${i}.spec.ts`), testContent);\n }\n\n logger.info(\n `${browser}: ${Object.keys(browserStories.entries).length} stories, ${\n browserChunks.length\n } test file(s)`,\n );\n }\n\n testFilePattern = \"storywright-*.spec.ts\";\n } else {\n // Default: shared test files for all browsers\n const chunks = chunkStories(targetStories.entries);\n testFilePattern = chunks.length === 1 ? \"storywright-0.spec.ts\" : \"storywright-*.spec.ts\";\n\n for (let i = 0; i < chunks.length; i++) {\n const chunkIndex: StoryIndex = { ...targetStories, entries: chunks[i] };\n const chunkPath = path.join(tmpDir, `target-stories-${i}.json`);\n await fs.writeFile(chunkPath, JSON.stringify(chunkIndex));\n\n const testContent = generateTestFile(config.screenshot, {\n targetStoriesPath: chunkPath.replace(/\\\\/g, \"/\"),\n });\n await fs.writeFile(path.join(tmpDir, `storywright-${i}.spec.ts`), testContent);\n }\n\n logger.info(`${chunks.length} test file(s) generated`);\n }\n\n // 6. Generate Playwright config\n const reporterWrapperPath = path.join(tmpDir, \"reporter.mjs\");\n const resolvedReporterPath = resolveReporterPath().replace(/\\\\/g, \"/\");\n const reporterOutputDir = reportDir.replace(/\\\\/g, \"/\");\n\n await fs.writeFile(\n reporterWrapperPath,\n `import StorywrightReporter from '${resolvedReporterPath}';\\nexport default class extends StorywrightReporter {\\n constructor() { super({ outputDir: '${reporterOutputDir}' }); }\\n}\\n`,\n );\n\n // Determine Storybook URL\n let actualStorybookUrl = config.storybook.url;\n const needsServer = !actualStorybookUrl;\n\n if (needsServer) {\n actualStorybookUrl = \"http://localhost:6007\";\n }\n\n const playwrightConfig = generatePlaywrightConfig(config, {\n tmpDir: tmpDir.replace(/\\\\/g, \"/\"),\n storybookUrl: actualStorybookUrl ?? \"http://localhost:6007\",\n snapshotDir: snapshotDir.replace(/\\\\/g, \"/\"),\n reporterPath: reporterWrapperPath.replace(/\\\\/g, \"/\"),\n testMatch: testFilePattern,\n testMatchByBrowser,\n shard: options.shard,\n reporters: options.reporters,\n updateSnapshots: options.updateSnapshots,\n });\n\n const configPath = path.join(tmpDir, \"playwright.config.ts\");\n await fs.writeFile(configPath, playwrightConfig);\n\n // 7. Run Playwright tests\n logger.start(\"Running tests...\");\n const args = [\"playwright\", \"test\", \"--config\", configPath];\n\n if (options.updateSnapshots) {\n args.push(\"--update-snapshots\");\n }\n\n // Start static server if needed\n let serverProc: { kill: () => void } | undefined;\n if (needsServer) {\n serverProc = await startStaticServer(storybookDir, 6007);\n }\n\n try {\n const result = await exec(\"npx\", args, { cwd, inherit: true });\n\n // 8. Read results\n let summary: TestSummary | undefined;\n try {\n const summaryPath = path.join(reportDir, \"summary.json\");\n const summaryContent = await fs.readFile(summaryPath, \"utf-8\");\n summary = JSON.parse(summaryContent);\n } catch {\n // summary may not exist if no tests ran\n }\n\n // 9. Map exit codes per SPEC §14.2\n const exitCode = mapExitCode(result.exitCode, summary);\n\n return { exitCode, summary, reportDir, snapshotDir };\n } finally {\n serverProc?.kill();\n }\n}\n\nexport async function updateBaselines(\n config: StorywrightConfig,\n options: {\n all?: boolean;\n upload?: boolean;\n shard?: string;\n filter?: string;\n } = {},\n cwd: string = process.cwd(),\n): Promise<TestRunResult> {\n const result = await runTests(\n config,\n {\n updateSnapshots: true,\n diffOnly: !options.all,\n shard: options.shard,\n filter: options.filter,\n },\n cwd,\n );\n\n if (result.exitCode !== 0) {\n logger.warn(\"Some tests failed during baseline update\");\n }\n\n // Save updated snapshots back to baselineDir (local disk operation)\n if (result.snapshotDir) {\n const baselineDir = path.resolve(cwd, config.storage.local.baselineDir);\n await fs.mkdir(baselineDir, { recursive: true });\n await fs.cp(result.snapshotDir, baselineDir, { recursive: true });\n logger.success(`Baselines saved to ${config.storage.local.baselineDir}`);\n }\n\n // --upload: upload to remote storage (S3 etc.) only when explicitly requested\n if (options.upload) {\n const storage = await createStorageAdapter(config.storage);\n const baselineDir = path.resolve(cwd, config.storage.local.baselineDir);\n await storage.upload({\n branch: config.storage.branch,\n sourceDir: baselineDir,\n shard: options.shard,\n onProgress: (msg) => logger.info(msg),\n });\n logger.success(\"Baselines uploaded to remote storage\");\n }\n\n return result;\n}\n\nfunction applyFilter(storyIndex: StoryIndex, filter: string): StoryIndex {\n const matcher = picomatch(filter);\n const entries: Record<string, StoryIndex[\"entries\"][string]> = {};\n for (const [id, story] of Object.entries(storyIndex.entries)) {\n const fullName = `${story.title}/${story.name}`;\n if (matcher(fullName) || matcher(story.title) || matcher(story.id)) {\n entries[id] = story;\n }\n }\n return { ...storyIndex, entries };\n}\n\nfunction mapExitCode(playwrightCode: number, summary?: TestSummary): number {\n // SPEC §14.2: 0 = success (no diff), 1 = success (diff found), 2 = execution error, 130 = SIGINT\n if (playwrightCode === 130 || playwrightCode === 143) {\n return 130; // SIGINT / SIGTERM\n }\n if (summary) {\n if (summary.failed > 0) return 1;\n if (summary.total === 0 && playwrightCode !== 0) return 2;\n return 0;\n }\n // No summary = likely execution error\n return playwrightCode === 0 ? 0 : 2;\n}\n\nasync function startStaticServer(dir: string, port: number): Promise<{ kill: () => void }> {\n const { createServer } = await import(\"node:http\");\n const sirv = (await import(\"sirv\")).default;\n\n const handler = sirv(dir, { single: false, dev: false });\n const server = createServer(handler);\n\n await new Promise<void>((resolve, reject) => {\n server.on(\"error\", reject);\n server.listen(port, () => resolve());\n });\n\n return { kill: () => server.close() };\n}\n","import { STANDARD_BROWSERS } from \"../config/types.js\";\nimport type { BrowserOption, StorywrightConfig } from \"../config/types.js\";\n\nexport function generatePlaywrightConfig(\n config: StorywrightConfig,\n options: {\n tmpDir: string;\n storybookUrl: string;\n snapshotDir: string;\n reporterPath: string;\n testMatch: string;\n testMatchByBrowser?: Record<string, string>;\n shard?: string;\n reporters?: string[];\n updateSnapshots?: boolean;\n },\n): string {\n const projects = config.browsers.map((browser) => {\n const rawOptions = config.browserOptions[browser];\n const useObj = buildBrowserUseObject(browser, rawOptions);\n const useStr = JSON.stringify(useObj, null, \"\\t\\t\");\n const testMatch = options.testMatchByBrowser?.[browser];\n const testMatchLine = testMatch ? `\\n\\t\\t\\ttestMatch: '${escapeBackslash(testMatch)}',` : \"\";\n return `\\t\\t{\n\\t\\t\\tname: '${browser}',${testMatchLine}\n\\t\\t\\tuse: ${useStr},\n\\t\\t}`;\n });\n\n const workers = config.workers === \"auto\" ? \"'100%'\" : String(config.workers);\n\n const shard = options.shard\n ? `\\tshard: { current: ${options.shard.split(\"/\")[0]}, total: ${options.shard.split(\"/\")[1]} },`\n : \"\";\n\n // Build reporter list: always include custom reporter, plus user-requested ones\n const reporterEntries: string[] = [];\n const requestedReporters = options.reporters ?? [\"default\", \"html\"];\n for (const r of requestedReporters) {\n if (r === \"default\" || r === \"list\") {\n reporterEntries.push(\"\\t\\t['list']\");\n } else if (r !== \"html\") {\n // Pass through other built-in Playwright reporters (dot, json, junit, etc.)\n reporterEntries.push(`\\t\\t['${r}']`);\n }\n }\n // Always include custom storywright reporter\n reporterEntries.push(`\\t\\t['${escapeBackslash(options.reporterPath)}']`);\n\n const testMatchLine = options.testMatchByBrowser\n ? \"\"\n : `\\ttestMatch: '${escapeBackslash(options.testMatch)}',\\n`;\n\n return `import { defineConfig } from '@playwright/test';\n\nexport default defineConfig({\n\\ttestDir: '${escapeBackslash(options.tmpDir)}',\n${testMatchLine}\\tsnapshotDir: '${escapeBackslash(options.snapshotDir)}',\n\\tsnapshotPathTemplate: '{snapshotDir}/{arg}-{projectName}{ext}',\n\\ttimeout: ${config.timeout.test},\n\\tupdateSnapshots: '${options.updateSnapshots ? \"all\" : \"none\"}',\n\\texpect: {\n\\t\\ttoHaveScreenshot: {\n\\t\\t\\tmaxDiffPixelRatio: ${config.screenshot.maxDiffPixelRatio},\n\\t\\t\\tthreshold: ${config.screenshot.threshold},\n\\t\\t},\n\\t\\ttimeout: ${config.timeout.expect},\n\\t},\n\\tfullyParallel: true,\n\\tforbidOnly: !!process.env.CI,\n\\tretries: ${config.retries},\n\\tworkers: ${workers},\n${shard}\n\\treporter: [\n${reporterEntries.join(\",\\n\")}\n\\t],\n\\tuse: {\n\\t\\tbaseURL: '${options.storybookUrl}',\n\\t\\tnavigationTimeout: ${config.timeout.navigation},\n\\t\\ttimezoneId: '${config.screenshot.timezone}',\n\\t\\tlocale: '${config.screenshot.locale}',\n\\t},\n\\tprojects: [\n${projects.join(\",\\n\")}\n\\t],\n});\n`;\n}\n\nfunction buildBrowserUseObject(\n browser: string,\n rawOptions?: BrowserOption,\n): Record<string, unknown> {\n let browserName: string;\n if (rawOptions?.browserName) {\n browserName = rawOptions.browserName;\n } else if (STANDARD_BROWSERS.has(browser)) {\n browserName = browser;\n } else {\n throw new Error(\n `Cannot resolve browserName for custom browser project '${browser}'.\\n\\nError code: SW_E_INTERNAL_BROWSER_RESOLVE`,\n );\n }\n const useObj: Record<string, unknown> = { browserName };\n\n if (rawOptions) {\n const { browserName: _, exclude: __, ...rest } = rawOptions;\n Object.assign(useObj, rest);\n }\n\n return useObj;\n}\n\nfunction escapeBackslash(str: string): string {\n return str.replace(/\\\\/g, \"/\");\n}\n","import type { ScreenshotConfig } from \"../config/types.js\";\n\nexport function generateTestFile(\n config: ScreenshotConfig,\n options: {\n targetStoriesPath: string;\n },\n): string {\n const disableAnimations = config.animations === \"disabled\";\n\n return `import { test, expect } from '@playwright/test';\nimport { readFileSync } from 'node:fs';\nimport { initPage, stabilizePage } from '@storywright/cli/playwright/stabilize';\n\nconst targetList = JSON.parse(\n\\treadFileSync('${escapeBackslash(options.targetStoriesPath)}', 'utf-8'),\n);\n\nconst stabilizeOptions = {\n\\tfreezeTime: '${config.freezeTime}',\n\\tseed: ${config.seed},\n\\tdisableAnimations: ${disableAnimations},\n};\n\ntest.describe.parallel('visual regression testing', () => {\n\\tif (Object.keys(targetList.entries).length === 0) {\n\\t\\ttest('no stories to test', () => {\n\\t\\t\\texpect(true).toBeTruthy();\n\\t\\t});\n\\t}\n\n\\tfor (const story of Object.values(targetList.entries)) {\n\\t\\ttest(\\`\\${story.title}: \\${story.name}\\`, async ({ page }, testInfo) => {\n\\t\\t\\tawait initPage(page, stabilizeOptions);\n\n\\t\\t\\tawait page.goto(\\`/iframe.html?id=\\${story.id}\\`, {\n\\t\\t\\t\\twaitUntil: 'domcontentloaded',\n\\t\\t\\t});\n\n\\t\\t\\tawait stabilizePage(page, stabilizeOptions);\n\n\\t\\t\\ttry {\n\\t\\t\\t\\tawait expect(page).toHaveScreenshot(\n\\t\\t\\t\\t\\t[story.title, \\`\\${story.id}.png\\`],\n\\t\\t\\t\\t\\t{\n\\t\\t\\t\\t\\t\\tanimations: '${config.animations}',\n\\t\\t\\t\\t\\t\\tfullPage: ${config.fullPage},\n\\t\\t\\t\\t\\t\\tthreshold: ${config.threshold},\n\\t\\t\\t\\t\\t\\tmaxDiffPixelRatio: ${config.maxDiffPixelRatio},\n\\t\\t\\t\\t\\t},\n\\t\\t\\t\\t);\n\\t\\t\\t} catch (error) {\n\\t\\t\\t\\t// When baseline is missing, Playwright skips screenshot capture entirely.\n\\t\\t\\t\\t// Capture one here so the report can show what the new story looks like.\n\\t\\t\\t\\tif (!testInfo.attachments.some(a => a.name.includes('-actual'))) {\n\\t\\t\\t\\t\\ttry {\n\\t\\t\\t\\t\\t\\tconst screenshot = await page.screenshot({ fullPage: ${config.fullPage} });\n\\t\\t\\t\\t\\t\\tawait testInfo.attach(\\`\\${story.id}-actual\\`, { body: screenshot, contentType: 'image/png' });\n\\t\\t\\t\\t\\t} catch {\n\\t\\t\\t\\t\\t\\t// ignore — best effort\n\\t\\t\\t\\t\\t}\n\\t\\t\\t\\t}\n\\t\\t\\t\\tthrow error;\n\\t\\t\\t}\n\\t\\t});\n\\t}\n});\n`;\n}\n\nfunction escapeBackslash(str: string): string {\n return str.replace(/\\\\/g, \"/\");\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport { simpleGit } from \"simple-git\";\nimport type { DiffDetectionConfig } from \"../config/types.js\";\nimport type { StatsIndex, StatsModule, StoryIndex } from \"../core/types.js\";\nimport { logger } from \"../utils/logger.js\";\nimport { normalizePath, stripLeadingDotSlash } from \"../utils/path.js\";\n\nexport interface DependencyResolver {\n getDependencies(filePath: string): string[];\n getStoriesForFiles(pathList: string[]): StoryIndex;\n}\n\nconst STORY_FILE_PATTERNS = [\".stories.\", \".mdx\"];\n\nfunction isStoryFile(moduleName: string): boolean {\n return STORY_FILE_PATTERNS.some((p) => moduleName.includes(p));\n}\n\nexport class StorybookStatsDependencyResolver implements DependencyResolver {\n private moduleMap: Record<string, StatsModule>;\n\n constructor(\n private statsJson: StatsIndex,\n private storiesJson: StoryIndex,\n ) {\n this.moduleMap = {};\n for (const mod of statsJson.modules) {\n // Key by normalized name (primary) and normalized id (fallback)\n const normalizedName = normalizePath(mod.name);\n this.moduleMap[normalizedName] = mod;\n const normalizedId = normalizePath(mod.id);\n if (normalizedId !== normalizedName) {\n this.moduleMap[normalizedId] ??= mod;\n }\n }\n }\n\n getDependencies(filePath: string): string[] {\n const normalizedPath = normalizePath(filePath);\n const dependencies = this.collectDependencies(normalizedPath);\n\n if (this.moduleMap[normalizedPath]) {\n dependencies.add(normalizedPath);\n }\n\n return [...dependencies];\n }\n\n getStoriesForFiles(pathList: string[]): StoryIndex {\n const result: StoryIndex = { v: this.storiesJson.v, entries: {} };\n\n for (const filePath of pathList) {\n // Finding #2 + #3: lookup via normalized moduleMap (name primary, id fallback)\n const normalizedPath = normalizePath(filePath);\n const stats = this.moduleMap[normalizedPath];\n if (!stats) continue;\n\n // Finding #1: collect ALL story reasons, not just first\n const storyReasons = stats.reasons.filter((r) => isStoryFile(r.moduleName));\n for (const reason of storyReasons) {\n const normalizedImportPath = normalizePath(reason.moduleName);\n // Collect ALL matching story entries per reason\n for (const storyObj of Object.values(this.storiesJson.entries)) {\n if (storyObj.type !== \"story\") continue;\n if (normalizePath(storyObj.importPath) === normalizedImportPath) {\n result.entries[storyObj.id] = storyObj;\n }\n }\n }\n }\n\n return result;\n }\n\n private collectDependencies(name: string, result = new Set<string>()): Set<string> {\n const mod = this.moduleMap[normalizePath(name)];\n if (mod) {\n for (const reason of mod.reasons) {\n if (!result.has(reason.moduleName)) {\n result.add(reason.moduleName);\n this.collectDependencies(reason.moduleName, result);\n }\n }\n }\n return result;\n }\n}\n\nexport interface DiffResult {\n allStories: boolean;\n targetStories: StoryIndex;\n}\n\ninterface DiffFileEntry {\n file: string;\n from?: string;\n}\n\nexport async function resolveAffectedStories(\n storiesJson: StoryIndex,\n config: DiffDetectionConfig,\n storybookStaticDir: string,\n cwd: string,\n): Promise<DiffResult> {\n const git = simpleGit({ baseDir: cwd });\n\n // Get diff summary\n let diffEntries: DiffFileEntry[];\n try {\n // Detect if HEAD is on the base branch (e.g. main)\n const currentBranch = (await git.raw([\"rev-parse\", \"--abbrev-ref\", \"HEAD\"])).trim();\n const isOnBaseBranch = currentBranch === config.baseBranch;\n\n let diffBase: string;\n if (isOnBaseBranch && config.baseBranchDiffDepth > 0) {\n // On the base branch, merge-base == HEAD so diff would be empty.\n // Use HEAD~N to compare against the previous commit(s) instead.\n diffBase = `HEAD~${config.baseBranchDiffDepth}`;\n logger.info(`On base branch '${config.baseBranch}', using ${diffBase} for diff detection`);\n } else {\n const mergeBase = await git.raw([\"merge-base\", config.baseBranch, \"HEAD\"]);\n diffBase = mergeBase.trim();\n }\n\n const diff = await git.diffSummary([diffBase, \"HEAD\"]);\n diffEntries = diff.files.map((f) => ({\n file: f.file,\n // Handle renames: include both old and new paths\n from: \"from\" in f ? (f as { from: string }).from : undefined,\n }));\n } catch {\n logger.warn(\"Failed to resolve git diff, running all stories\");\n return { allStories: true, targetStories: storiesJson };\n }\n\n if (diffEntries.length === 0) {\n logger.info(\"No changed files detected\");\n return { allStories: false, targetStories: { v: storiesJson.v, entries: {} } };\n }\n\n // Collect all affected paths (including rename sources)\n const allPaths: string[] = [];\n for (const entry of diffEntries) {\n allPaths.push(entry.file);\n if (entry.from) {\n allPaths.push(entry.from);\n }\n }\n\n // Check watchFiles\n for (const file of allPaths) {\n for (const pattern of config.watchFiles) {\n if (picomatch(pattern)(file)) {\n logger.info(`Watch file changed: ${file}, running all stories`);\n return { allStories: true, targetStories: storiesJson };\n }\n }\n }\n\n // Load stats json for dependency resolution\n const statsPath = path.resolve(storybookStaticDir, \"preview-stats.json\");\n let statsJson: StatsIndex;\n try {\n statsJson = JSON.parse(await fs.readFile(statsPath, \"utf-8\"));\n } catch {\n logger.warn(\"preview-stats.json not found, running all stories\");\n return { allStories: true, targetStories: storiesJson };\n }\n\n const resolver = new StorybookStatsDependencyResolver(statsJson, storiesJson);\n const targetStories: StoryIndex = { v: storiesJson.v, entries: {} };\n\n // Direct story file matches (both .stories.* and .mdx)\n for (const file of allPaths) {\n const matchedStories = Object.values(storiesJson.entries).filter(\n (story) => stripLeadingDotSlash(story.importPath) === file,\n );\n for (const story of matchedStories) {\n targetStories.entries[story.id] = story;\n }\n }\n\n // Dependency-based matches\n for (const file of allPaths) {\n const deps = resolver.getDependencies(normalizePath(file));\n const depStories = resolver.getStoriesForFiles(deps);\n for (const [id, story] of Object.entries(depStories.entries)) {\n targetStories.entries[id] = story;\n }\n }\n\n logger.info(`Resolved ${Object.keys(targetStories.entries).length} affected stories`);\n return { allStories: false, targetStories };\n}\n","import path from \"node:path\";\n\nexport function normalizePath(filePath: string): string {\n const normalized = filePath.replace(/\\\\/g, \"/\");\n if (normalized.startsWith(\"./\")) {\n return normalized;\n }\n return `./${normalized}`;\n}\n\nexport function stripLeadingDotSlash(filePath: string): string {\n return filePath.replace(/^\\.\\//, \"\");\n}\n\nexport function resolveOutputDir(outputDir: string, ...segments: string[]): string {\n return path.resolve(outputDir, ...segments);\n}\n","import { spawn } from \"node:child_process\";\n\nexport interface ExecResult {\n exitCode: number;\n stdout: string;\n stderr: string;\n}\n\nexport function exec(\n command: string,\n args: string[],\n options?: { cwd?: string; env?: Record<string, string>; inherit?: boolean },\n): Promise<ExecResult> {\n return new Promise((resolve, reject) => {\n const proc = spawn(command, args, {\n cwd: options?.cwd,\n env: { ...process.env, ...options?.env },\n stdio: options?.inherit ? [\"ignore\", \"inherit\", \"inherit\"] : [\"ignore\", \"pipe\", \"pipe\"],\n shell: false,\n });\n\n let stdout = \"\";\n let stderr = \"\";\n\n if (!options?.inherit) {\n proc.stdout?.on(\"data\", (data: Buffer) => {\n stdout += data.toString();\n });\n\n proc.stderr?.on(\"data\", (data: Buffer) => {\n stderr += data.toString();\n });\n }\n\n proc.on(\"error\", reject);\n\n proc.on(\"close\", (code) => {\n resolve({ exitCode: code ?? 1, stdout, stderr });\n });\n });\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport type { StorywrightConfig } from \"../config/types.js\";\nimport { logger } from \"../utils/logger.js\";\nimport { exec } from \"../utils/process.js\";\nimport type { Story, StoryIndex } from \"./types.js\";\n\nexport async function buildStorybook(config: StorywrightConfig, cwd: string): Promise<void> {\n if (config.storybook.url) {\n logger.info(\"Using running Storybook at\", config.storybook.url);\n return;\n }\n\n const staticDir = path.resolve(cwd, config.storybook.staticDir);\n try {\n await fs.access(path.join(staticDir, \"index.json\"));\n logger.info(\"Storybook already built at\", staticDir);\n return;\n } catch {\n // need to build\n }\n\n logger.start(\"Building Storybook...\");\n const [command, ...args] = config.storybook.buildCommand.split(\" \");\n const result = await exec(command, args, { cwd });\n if (result.exitCode !== 0) {\n throw new Error(\n `Storybook build failed (exit code ${result.exitCode}):\\n${result.stderr}\\n\\nError code: SW_E_STORYBOOK_BUILD_FAILED`,\n );\n }\n logger.success(\"Storybook built\");\n}\n\nexport async function discoverStories(config: StorywrightConfig, cwd: string): Promise<StoryIndex> {\n const staticDir = path.resolve(cwd, config.storybook.staticDir);\n const indexPath = path.join(staticDir, \"index.json\");\n\n try {\n await fs.access(indexPath);\n } catch {\n throw new Error(\n `Storybook build directory not found at '${config.storybook.staticDir}/'\\n\\n Run one of the following:\\n $ npx storybook build --stats-json\\n $ npx storywright test --storybook-url http://localhost:6006\\n\\n Error code: SW_E_STORYBOOK_DIR_NOT_FOUND`,\n );\n }\n\n const raw = JSON.parse(await fs.readFile(indexPath, \"utf-8\"));\n const indexJson = normalizeStoryIndex(raw, config.storybook.compatibility);\n\n // Version check\n if (indexJson.v < 4) {\n throw new Error(\n \"Storybook 7.x or earlier is not supported. Storywright requires Storybook 8 or later.\\n\\nError code: SW_E_STORYBOOK_UNSUPPORTED\",\n );\n }\n\n return indexJson;\n}\n\n/**\n * Parse Storybook index.json (v8+).\n */\nfunction normalizeStoryIndex(\n raw: Record<string, unknown>,\n _compatibility: \"auto\" | \"v8\",\n): StoryIndex {\n const version = typeof raw.v === \"number\" ? raw.v : 0;\n const entries = (raw.entries ?? {}) as Record<string, Story>;\n\n return { v: version, entries };\n}\n\nexport function filterStories(storyIndex: StoryIndex, config: StorywrightConfig): StoryIndex {\n const entries: Record<string, Story> = {};\n const includeMatchers = config.include.map((p) => picomatch(p));\n const excludeMatchers = config.exclude.map((p) => picomatch(p));\n\n for (const [id, story] of Object.entries(storyIndex.entries)) {\n // Skip docs entries\n if (story.type === \"docs\") continue;\n if (story.name === \"Docs\") continue;\n\n const fullName = `${story.title}/${story.name}`;\n\n // Check include patterns\n const isIncluded = includeMatchers.some((m) => m(fullName));\n if (!isIncluded) continue;\n\n // Check exclude patterns\n const isExcluded = excludeMatchers.some((m) => m(fullName));\n if (isExcluded) continue;\n\n entries[id] = story;\n }\n\n return { ...storyIndex, entries };\n}\n\nexport function excludeStoriesForBrowser(\n storyIndex: StoryIndex,\n excludePatterns: string[],\n): StoryIndex {\n if (excludePatterns.length === 0) {\n return storyIndex;\n }\n\n const excludeMatchers = excludePatterns.map((p) => picomatch(p));\n const entries: Record<string, Story> = {};\n\n for (const [id, story] of Object.entries(storyIndex.entries)) {\n const fullName = `${story.title}/${story.name}`;\n const isExcluded = excludeMatchers.some((m) => m(fullName));\n if (!isExcluded) {\n entries[id] = story;\n }\n }\n\n return { ...storyIndex, entries };\n}\n"],"mappings":";AAAA,SAAS,cAAc,oBAAoB;;;ACEpC,IAAM,iBAAoC;AAAA,EAC/C,WAAW;AAAA,IACT,WAAW;AAAA,IACX,cAAc;AAAA,IACd,KAAK;AAAA,IACL,eAAe;AAAA,EACjB;AAAA,EAEA,UAAU,CAAC,UAAU;AAAA,EACrB,gBAAgB,CAAC;AAAA,EAEjB,YAAY;AAAA,IACV,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,mBAAmB;AAAA,IACnB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EAEA,eAAe;AAAA,IACb,SAAS;AAAA,IACT,YAAY,CAAC,gBAAgB,qBAAqB,iBAAiB;AAAA,IACnE,YAAY;AAAA,IACZ,qBAAqB;AAAA,EACvB;AAAA,EAEA,SAAS;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Backslash","fs","path","path","path","fs","fs","path","picomatch","path","fs","picomatch","path","fs","picomatch"]}
@@ -58,40 +58,7 @@ var StorywrightReporter = class {
58
58
  });
59
59
  continue;
60
60
  }
61
- const sanitizedName = testResult.title.replace(/[^a-zA-Z0-9-_]/g, "-").toLowerCase();
62
- const imageAttachments = testResult.attachments.filter(
63
- (a) => a.path && a.contentType.startsWith("image/")
64
- );
65
- const hasExpected = imageAttachments.some((a) => a.name.includes("expected"));
66
- const entry = {
67
- type: hasExpected ? "diff" : "new",
68
- story: storyTitle,
69
- variant,
70
- browser: testResult.project,
71
- diffRatio: 0,
72
- expected: "",
73
- actual: "",
74
- diff: ""
75
- };
76
- for (const attachment of testResult.attachments) {
77
- if (!attachment.path) continue;
78
- const ext = path.extname(attachment.path);
79
- const destName = `${sanitizedName}-${testResult.project}${ext}`;
80
- if (attachment.name.includes("expected")) {
81
- const dest = path.join(assetsDir, "expected", destName);
82
- copyFileIfExists(attachment.path, dest);
83
- entry.expected = `assets/expected/${destName}`;
84
- } else if (attachment.name.includes("actual")) {
85
- const dest = path.join(assetsDir, "actual", destName);
86
- copyFileIfExists(attachment.path, dest);
87
- entry.actual = `assets/actual/${destName}`;
88
- } else if (attachment.name.includes("diff")) {
89
- const dest = path.join(assetsDir, "diff", destName);
90
- copyFileIfExists(attachment.path, dest);
91
- entry.diff = `assets/diff/${destName}`;
92
- }
93
- }
94
- entries.push(entry);
61
+ entries.push(buildEntry(testResult, assetsDir));
95
62
  }
96
63
  const summary = {
97
64
  total: allResults.length,
@@ -109,6 +76,45 @@ var StorywrightReporter = class {
109
76
  fs.writeFileSync(path.join(this.outputDir, "index.html"), html);
110
77
  }
111
78
  };
79
+ function buildEntry(result, assetsDir, copier = copyFileIfExists) {
80
+ const titleParts = result.title.split(": ");
81
+ const storyTitle = titleParts[0] ?? result.title;
82
+ const variant = titleParts.slice(1).join(": ") || "default";
83
+ const sanitizedName = result.title.replace(/[^a-zA-Z0-9-_]/g, "-").toLowerCase();
84
+ const imageAttachments = result.attachments.filter(
85
+ (a) => a.path && a.contentType.startsWith("image/")
86
+ );
87
+ const hasExpected = imageAttachments.some((a) => a.name.includes("expected"));
88
+ const entry = {
89
+ type: hasExpected ? "diff" : "new",
90
+ story: storyTitle,
91
+ variant,
92
+ browser: result.project,
93
+ diffRatio: 0,
94
+ expected: "",
95
+ actual: "",
96
+ diff: ""
97
+ };
98
+ for (const attachment of result.attachments) {
99
+ if (!attachment.path) continue;
100
+ const ext = path.extname(attachment.path);
101
+ const destName = `${sanitizedName}-${result.project}${ext}`;
102
+ if (attachment.name.includes("expected")) {
103
+ const dest = path.join(assetsDir, "expected", destName);
104
+ copier(attachment.path, dest);
105
+ entry.expected = `assets/expected/${destName}`;
106
+ } else if (attachment.name.includes("actual")) {
107
+ const dest = path.join(assetsDir, "actual", destName);
108
+ copier(attachment.path, dest);
109
+ entry.actual = `assets/actual/${destName}`;
110
+ } else if (attachment.name.includes("diff")) {
111
+ const dest = path.join(assetsDir, "diff", destName);
112
+ copier(attachment.path, dest);
113
+ entry.diff = `assets/diff/${destName}`;
114
+ }
115
+ }
116
+ return entry;
117
+ }
112
118
  function copyFileIfExists(src, dest) {
113
119
  try {
114
120
  fs.copyFileSync(src, dest);
@@ -150,7 +156,8 @@ ${cssContent ? `<style>${cssContent}</style>` : ""}
150
156
  var reporter_default = StorywrightReporter;
151
157
 
152
158
  export {
159
+ buildEntry,
153
160
  generateHtmlReport,
154
161
  reporter_default
155
162
  };
156
- //# sourceMappingURL=chunk-HOJE6RXD.js.map
163
+ //# sourceMappingURL=chunk-UFQUIFGE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/playwright/reporter.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type {\n FullConfig,\n FullResult,\n TestResult as PwTestResult,\n Reporter,\n Suite,\n TestCase,\n} from \"@playwright/test/reporter\";\nimport type { TestEntry, TestSummary } from \"../core/types.js\";\n\ninterface StorywrightReporterOptions {\n outputDir?: string;\n}\n\nclass StorywrightReporter implements Reporter {\n private outputDir: string;\n private results = new Map<\n string,\n {\n title: string;\n project: string;\n status: \"passed\" | \"failed\" | \"skipped\";\n duration: number;\n attachments: { name: string; path?: string; contentType: string }[];\n }\n >();\n private startTime = 0;\n\n constructor(options: StorywrightReporterOptions = {}) {\n this.outputDir = options.outputDir || path.resolve(\".storywright\", \"report\");\n }\n\n onBegin(_config: FullConfig, _suite: Suite): void {\n this.startTime = Date.now();\n }\n\n onTestEnd(test: TestCase, result: PwTestResult): void {\n const project = test.parent?.project()?.name ?? \"unknown\";\n const key = `${test.title}::${project}`;\n const status =\n result.status === \"passed\" ? \"passed\" : result.status === \"skipped\" ? \"skipped\" : \"failed\";\n\n // Overwrite previous attempts so only the final retry result is kept\n this.results.set(key, {\n title: test.title,\n project,\n status,\n duration: result.duration,\n attachments: result.attachments.map((a) => ({\n name: a.name,\n path: a.path,\n contentType: a.contentType,\n })),\n });\n }\n\n async onEnd(_result: FullResult): Promise<void> {\n const duration = Date.now() - this.startTime;\n const allResults = [...this.results.values()];\n const passed = allResults.filter((r) => r.status === \"passed\").length;\n const failed = allResults.filter((r) => r.status === \"failed\").length;\n const skipped = allResults.filter((r) => r.status === \"skipped\").length;\n\n const browsers = [...new Set(allResults.map((r) => r.project))];\n const entries: TestEntry[] = [];\n\n // Collect failure images\n const assetsDir = path.join(this.outputDir, \"assets\");\n for (const dir of [\"expected\", \"actual\", \"diff\"]) {\n fs.mkdirSync(path.join(assetsDir, dir), { recursive: true });\n }\n\n for (const testResult of allResults) {\n if (testResult.status === \"skipped\") continue;\n\n const titleParts = testResult.title.split(\": \");\n const storyTitle = titleParts[0] ?? testResult.title;\n const variant = titleParts.slice(1).join(\": \") || \"default\";\n\n if (testResult.status === \"passed\") {\n entries.push({\n type: \"pass\",\n story: storyTitle,\n variant,\n browser: testResult.project,\n diffRatio: 0,\n expected: \"\",\n actual: \"\",\n diff: \"\",\n });\n continue;\n }\n\n entries.push(buildEntry(testResult, assetsDir));\n }\n\n const summary: TestSummary = {\n total: allResults.length,\n passed,\n failed,\n skipped,\n duration,\n timestamp: new Date().toISOString(),\n browsers,\n entries,\n };\n\n fs.mkdirSync(this.outputDir, { recursive: true });\n fs.writeFileSync(path.join(this.outputDir, \"summary.json\"), JSON.stringify(summary, null, 2));\n\n // Generate HTML report\n const html = generateHtmlReport(summary);\n fs.writeFileSync(path.join(this.outputDir, \"index.html\"), html);\n }\n}\n\nexport interface RawTestResult {\n title: string;\n project: string;\n attachments: { name: string; path?: string; contentType: string }[];\n}\n\nexport function buildEntry(\n result: RawTestResult,\n assetsDir: string,\n copier: (src: string, dest: string) => void = copyFileIfExists,\n): TestEntry {\n const titleParts = result.title.split(\": \");\n const storyTitle = titleParts[0] ?? result.title;\n const variant = titleParts.slice(1).join(\": \") || \"default\";\n const sanitizedName = result.title.replace(/[^a-zA-Z0-9-_]/g, \"-\").toLowerCase();\n\n const imageAttachments = result.attachments.filter(\n (a) => a.path && a.contentType.startsWith(\"image/\"),\n );\n const hasExpected = imageAttachments.some((a) => a.name.includes(\"expected\"));\n\n const entry: TestEntry = {\n type: hasExpected ? \"diff\" : \"new\",\n story: storyTitle,\n variant,\n browser: result.project,\n diffRatio: 0,\n expected: \"\",\n actual: \"\",\n diff: \"\",\n };\n\n for (const attachment of result.attachments) {\n if (!attachment.path) continue;\n const ext = path.extname(attachment.path);\n const destName = `${sanitizedName}-${result.project}${ext}`;\n\n if (attachment.name.includes(\"expected\")) {\n const dest = path.join(assetsDir, \"expected\", destName);\n copier(attachment.path, dest);\n entry.expected = `assets/expected/${destName}`;\n } else if (attachment.name.includes(\"actual\")) {\n const dest = path.join(assetsDir, \"actual\", destName);\n copier(attachment.path, dest);\n entry.actual = `assets/actual/${destName}`;\n } else if (attachment.name.includes(\"diff\")) {\n const dest = path.join(assetsDir, \"diff\", destName);\n copier(attachment.path, dest);\n entry.diff = `assets/diff/${destName}`;\n }\n }\n\n return entry;\n}\n\nfunction copyFileIfExists(src: string, dest: string): void {\n try {\n fs.copyFileSync(src, dest);\n } catch {\n // source may not exist\n }\n}\n\nexport function generateHtmlReport(summary: TestSummary): string {\n const require = createRequire(import.meta.url);\n const bundlePath = require.resolve(\"@storywright/report\");\n const bundleJs = fs.readFileSync(bundlePath, \"utf-8\");\n\n // Load CSS if it exists as a separate file\n const bundleDir = path.dirname(bundlePath);\n const assetsDir = path.join(bundleDir, \"assets\");\n let cssContent = \"\";\n if (fs.existsSync(assetsDir)) {\n const cssFiles = fs.readdirSync(assetsDir).filter((f) => f.endsWith(\".css\"));\n for (const cssFile of cssFiles) {\n cssContent += fs.readFileSync(path.join(assetsDir, cssFile), \"utf-8\");\n }\n }\n\n return `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Storywright Report</title>\n<link rel=\"icon\" type=\"image/png\" href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAaTUlEQVR42u2de5QcVZ3HPwlJeJNMMgnJDSZGAhxYQVh3EQmvDBIJJhB5qjzE44aH4hHYJax6dF3A44KKspuDCC6rEEAeCZMHKqDAQYMB5Yj4AEIAUXIzMyET8iAECNz9o6eTmUlPd3XVvfXo/n7O0VTXXO793V/dz2+qp6urQAghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgiRIYOyDiAJdsLsycAU4EBgH2ASMAYYCQzNOr76cL02XeX95W03wP7er12V/377MTYBrwIrwb0EPAs8hXNLzaqfdGedGRGOQhUAO2H2cGAmcBxwLDA+65j8kKn81do44PfgHgZ+BjxiVt35TtbZEv7IfQGwE2YPoiT8eZTkH5Z1TH7JrfyVxugAdytwo1l114qsMyeSk9sCYCfMHgKcBVwGHJB1PGEolPy9Y3HgFgPfNB13L8s6iyI+uSwAdsLsk4FrgL2zjiUchZW//3+/ELjcdN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w3dK3x3qgKQPr+U/PXMV/TwyxCdqgCkjXOPAm/1vOj9g95tKu+X/M3MgyE6VQFIGbP5mfXAA5K/VhyiF28Bi0N0rAKQCe7WXtu9NiW/qMhiQ/e6EB2rAGRDO/Cq5B8gRtGfG0N1rAKQAWbzs2+Bu2HrDskvBuYvBHr/DyoAWfI/wOuSX9TgW4buYIlSAcgIs/m5Lpybu22P5Bfb8QIwL+QAKgDZcjXQLfnFAMwxdG8JOYAKQIaYN5evBfeVbXskv9jKQ4buBaEHUQHInhuBpZJf9GIzcH4aA6kAZIx58/l3wZ0LvC75RQ9zQlz3XwkVgBxg3lyxAsfnSq8kf5OzBJibuJeIDMp6tmIbdtje1wMXll5J/iZkBXCooXttWgPqDCBffJFK3xOQ/M1ANzAjTflBZwC5ww5733DgAeBQyd80bALaDN2Ppz2wzgByhnnrxXXAdHBPSv6mYBMwMwv5QWcAucUOnTQcWALuiG17JX+D0Q2ckJX8oDOA3GLefmkduI8Ad5T2SP4GYwVweJbyg84ACoEdOvFSSpcNDwEkf/FZApyT9h/8KqECUBDs0ImHArfh3ORteyV/wdgMzAHmhvyGXz2oABQIO2TCzsDXgUvBDdn2E8lfAB4CLjB0e3+4RxJUAAqIHfKe/YBrgBMlf+55gdKlvcG/2BMHFYACY4fsdRjwJRwzwfU6lpI/BzxDqUjPC/2V3iSoADQAdofxk4HzgHPA7bntJ5I/Zd6i9Ae+HwAP5uV9fjVUABoIu4PZATiG0oVEU4FDcAyS/EFZSemhHQ8S8O69oVABaGDs4HEjwU0BDgb2BzcJGA+MArcLIPmjsQVYA3QBfwWWU3pQ59K0vrYrhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCiMbi/wFvDkONfZ98cgAAAABJRU5ErkJggg==\">\n${cssContent ? `<style>${cssContent}</style>` : \"\"}\n</head>\n<body>\n<div id=\"app\"></div>\n<script>window.__STORYWRIGHT_SUMMARY__ = ${JSON.stringify(summary).replace(\n /</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;AAAA,IACtC;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,KAAa,MAAoB;AACzD,MAAI;AACF,OAAG,aAAa,KAAK,IAAI;AAAA,EAC3B,QAAQ;AAAA,EAER;AACF;AAEO,SAAS,mBAAmB,SAA8B;AAC/D,QAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,QAAM,aAAaA,SAAQ,QAAQ,qBAAqB;AACxD,QAAM,WAAW,GAAG,aAAa,YAAY,OAAO;AAGpD,QAAM,YAAY,KAAK,QAAQ,UAAU;AACzC,QAAM,YAAY,KAAK,KAAK,WAAW,QAAQ;AAC/C,MAAI,aAAa;AACjB,MAAI,GAAG,WAAW,SAAS,GAAG;AAC5B,UAAM,WAAW,GAAG,YAAY,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC;AAC3E,eAAW,WAAW,UAAU;AAC9B,oBAAc,GAAG,aAAa,KAAK,KAAK,WAAW,OAAO,GAAG,OAAO;AAAA,IACtE;AAAA,EACF;AAEA,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOP,aAAa,UAAU,UAAU,aAAa,EAAE;AAAA;AAAA;AAAA;AAAA,2CAIP,KAAK,UAAU,OAAO,EAAE;AAAA,IAC/D;AAAA,IACA;AAAA,EACF,CAAC;AAAA,UACO,QAAQ;AAAA;AAAA;AAGlB;AAEA,IAAO,mBAAQ;","names":["require"]}
package/dist/cli.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  runNotifiers,
10
10
  runTests,
11
11
  updateBaselines
12
- } from "./chunk-LTWFZFDB.js";
12
+ } from "./chunk-U4SVAJV4.js";
13
13
  import {
14
14
  generateHtmlReport
15
- } from "./chunk-HOJE6RXD.js";
15
+ } from "./chunk-UFQUIFGE.js";
16
16
 
17
17
  // src/cli/index.ts
18
18
  import { defineCommand as defineCommand8, runMain } from "citty";
@@ -613,7 +613,7 @@ var uploadCommand = defineCommand7({
613
613
  var main = defineCommand8({
614
614
  meta: {
615
615
  name: "storywright",
616
- version: "1.6.0",
616
+ version: "1.6.2",
617
617
  description: "Zero-config visual regression testing powered by Storybook + Playwright"
618
618
  },
619
619
  subCommands: {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Page } from '@playwright/test';
2
- import { T as TestSummary, a as TestResult } from './types-sCGaLlki.js';
3
- export { S as Story, b as StoryIndex, c as TestEntry } from './types-sCGaLlki.js';
2
+ import { a as TestSummary, b as TestResult } from './types-DZfDPA65.js';
3
+ export { S as Story, c as StoryIndex, T as TestEntry } from './types-DZfDPA65.js';
4
4
 
5
5
  interface Notifier {
6
6
  name: string;
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  runNotifiers,
10
10
  runTests,
11
11
  updateBaselines
12
- } from "./chunk-LTWFZFDB.js";
12
+ } from "./chunk-U4SVAJV4.js";
13
13
 
14
14
  // src/core/index.ts
15
15
  import path from "path";
@@ -1,5 +1,5 @@
1
1
  import { Reporter, FullConfig, Suite, TestCase, TestResult, FullResult } from '@playwright/test/reporter';
2
- import { T as TestSummary } from '../types-sCGaLlki.js';
2
+ import { T as TestEntry, a as TestSummary } from '../types-DZfDPA65.js';
3
3
 
4
4
  interface StorywrightReporterOptions {
5
5
  outputDir?: string;
@@ -13,6 +13,16 @@ declare class StorywrightReporter implements Reporter {
13
13
  onTestEnd(test: TestCase, result: TestResult): void;
14
14
  onEnd(_result: FullResult): Promise<void>;
15
15
  }
16
+ interface RawTestResult {
17
+ title: string;
18
+ project: string;
19
+ attachments: {
20
+ name: string;
21
+ path?: string;
22
+ contentType: string;
23
+ }[];
24
+ }
25
+ declare function buildEntry(result: RawTestResult, assetsDir: string, copier?: (src: string, dest: string) => void): TestEntry;
16
26
  declare function generateHtmlReport(summary: TestSummary): string;
17
27
 
18
- export { StorywrightReporter as default, generateHtmlReport };
28
+ export { type RawTestResult, buildEntry, StorywrightReporter as default, generateHtmlReport };
@@ -1,8 +1,10 @@
1
1
  import {
2
+ buildEntry,
2
3
  generateHtmlReport,
3
4
  reporter_default
4
- } from "../chunk-HOJE6RXD.js";
5
+ } from "../chunk-UFQUIFGE.js";
5
6
  export {
7
+ buildEntry,
6
8
  reporter_default as default,
7
9
  generateHtmlReport
8
10
  };
@@ -42,4 +42,4 @@ interface TestEntry {
42
42
  diff: string;
43
43
  }
44
44
 
45
- export type { Story as S, TestSummary as T, TestResult as a, StoryIndex as b, TestEntry as c };
45
+ export type { Story as S, TestEntry as T, TestSummary as a, TestResult as b, StoryIndex as c };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storywright/cli",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Zero-config visual regression testing powered by Storybook + Playwright",
5
5
  "keywords": [
6
6
  "playwright",
@@ -48,7 +48,7 @@
48
48
  "simple-git": "^3.36.0",
49
49
  "sirv": "^3.0.2",
50
50
  "unconfig": "^0.6.1",
51
- "@storywright/report": "1.5.0"
51
+ "@storywright/report": "1.6.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@playwright/test": "^1.59.1",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/playwright/reporter.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type {\n FullConfig,\n FullResult,\n TestResult as PwTestResult,\n Reporter,\n Suite,\n TestCase,\n} from \"@playwright/test/reporter\";\nimport type { TestEntry, TestSummary } from \"../core/types.js\";\n\ninterface StorywrightReporterOptions {\n outputDir?: string;\n}\n\nclass StorywrightReporter implements Reporter {\n private outputDir: string;\n private results = new Map<\n string,\n {\n title: string;\n project: string;\n status: \"passed\" | \"failed\" | \"skipped\";\n duration: number;\n attachments: { name: string; path?: string; contentType: string }[];\n }\n >();\n private startTime = 0;\n\n constructor(options: StorywrightReporterOptions = {}) {\n this.outputDir = options.outputDir || path.resolve(\".storywright\", \"report\");\n }\n\n onBegin(_config: FullConfig, _suite: Suite): void {\n this.startTime = Date.now();\n }\n\n onTestEnd(test: TestCase, result: PwTestResult): void {\n const project = test.parent?.project()?.name ?? \"unknown\";\n const key = `${test.title}::${project}`;\n const status =\n result.status === \"passed\" ? \"passed\" : result.status === \"skipped\" ? \"skipped\" : \"failed\";\n\n // Overwrite previous attempts so only the final retry result is kept\n this.results.set(key, {\n title: test.title,\n project,\n status,\n duration: result.duration,\n attachments: result.attachments.map((a) => ({\n name: a.name,\n path: a.path,\n contentType: a.contentType,\n })),\n });\n }\n\n async onEnd(_result: FullResult): Promise<void> {\n const duration = Date.now() - this.startTime;\n const allResults = [...this.results.values()];\n const passed = allResults.filter((r) => r.status === \"passed\").length;\n const failed = allResults.filter((r) => r.status === \"failed\").length;\n const skipped = allResults.filter((r) => r.status === \"skipped\").length;\n\n const browsers = [...new Set(allResults.map((r) => r.project))];\n const entries: TestEntry[] = [];\n\n // Collect failure images\n const assetsDir = path.join(this.outputDir, \"assets\");\n for (const dir of [\"expected\", \"actual\", \"diff\"]) {\n fs.mkdirSync(path.join(assetsDir, dir), { recursive: true });\n }\n\n for (const testResult of allResults) {\n if (testResult.status === \"skipped\") continue;\n\n const titleParts = testResult.title.split(\": \");\n const storyTitle = titleParts[0] ?? testResult.title;\n const variant = titleParts.slice(1).join(\": \") || \"default\";\n\n if (testResult.status === \"passed\") {\n entries.push({\n type: \"pass\",\n story: storyTitle,\n variant,\n browser: testResult.project,\n diffRatio: 0,\n expected: \"\",\n actual: \"\",\n diff: \"\",\n });\n continue;\n }\n\n const sanitizedName = testResult.title.replace(/[^a-zA-Z0-9-_]/g, \"-\").toLowerCase();\n\n const imageAttachments = testResult.attachments.filter(\n (a) => a.path && a.contentType.startsWith(\"image/\"),\n );\n const hasExpected = imageAttachments.some((a) => a.name.includes(\"expected\"));\n\n const entry: TestEntry = {\n type: hasExpected ? \"diff\" : \"new\",\n story: storyTitle,\n variant,\n browser: testResult.project,\n diffRatio: 0,\n expected: \"\",\n actual: \"\",\n diff: \"\",\n };\n\n for (const attachment of testResult.attachments) {\n if (!attachment.path) continue;\n const ext = path.extname(attachment.path);\n const destName = `${sanitizedName}-${testResult.project}${ext}`;\n\n if (attachment.name.includes(\"expected\")) {\n const dest = path.join(assetsDir, \"expected\", destName);\n copyFileIfExists(attachment.path, dest);\n entry.expected = `assets/expected/${destName}`;\n } else if (attachment.name.includes(\"actual\")) {\n const dest = path.join(assetsDir, \"actual\", destName);\n copyFileIfExists(attachment.path, dest);\n entry.actual = `assets/actual/${destName}`;\n } else if (attachment.name.includes(\"diff\")) {\n const dest = path.join(assetsDir, \"diff\", destName);\n copyFileIfExists(attachment.path, dest);\n entry.diff = `assets/diff/${destName}`;\n }\n }\n\n entries.push(entry);\n }\n\n const summary: TestSummary = {\n total: allResults.length,\n passed,\n failed,\n skipped,\n duration,\n timestamp: new Date().toISOString(),\n browsers,\n entries,\n };\n\n fs.mkdirSync(this.outputDir, { recursive: true });\n fs.writeFileSync(path.join(this.outputDir, \"summary.json\"), JSON.stringify(summary, null, 2));\n\n // Generate HTML report\n const html = generateHtmlReport(summary);\n fs.writeFileSync(path.join(this.outputDir, \"index.html\"), html);\n }\n}\n\nfunction copyFileIfExists(src: string, dest: string): void {\n try {\n fs.copyFileSync(src, dest);\n } catch {\n // source may not exist\n }\n}\n\nexport function generateHtmlReport(summary: TestSummary): string {\n const require = createRequire(import.meta.url);\n const bundlePath = require.resolve(\"@storywright/report\");\n const bundleJs = fs.readFileSync(bundlePath, \"utf-8\");\n\n // Load CSS if it exists as a separate file\n const bundleDir = path.dirname(bundlePath);\n const assetsDir = path.join(bundleDir, \"assets\");\n let cssContent = \"\";\n if (fs.existsSync(assetsDir)) {\n const cssFiles = fs.readdirSync(assetsDir).filter((f) => f.endsWith(\".css\"));\n for (const cssFile of cssFiles) {\n cssContent += fs.readFileSync(path.join(assetsDir, cssFile), \"utf-8\");\n }\n }\n\n return `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Storywright Report</title>\n<link rel=\"icon\" type=\"image/png\" href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAaTUlEQVR42u2de5QcVZ3HPwlJeJNMMgnJDSZGAhxYQVh3EQmvDBIJJhB5qjzE44aH4hHYJax6dF3A44KKspuDCC6rEEAeCZMHKqDAQYMB5Yj4AEIAUXIzMyET8iAECNz9o6eTmUlPd3XVvfXo/n7O0VTXXO793V/dz2+qp6urQAghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgiRIYOyDiAJdsLsycAU4EBgH2ASMAYYCQzNOr76cL02XeX95W03wP7er12V/377MTYBrwIrwb0EPAs8hXNLzaqfdGedGRGOQhUAO2H2cGAmcBxwLDA+65j8kKn81do44PfgHgZ+BjxiVt35TtbZEv7IfQGwE2YPoiT8eZTkH5Z1TH7JrfyVxugAdytwo1l114qsMyeSk9sCYCfMHgKcBVwGHJB1PGEolPy9Y3HgFgPfNB13L8s6iyI+uSwAdsLsk4FrgL2zjiUchZW//3+/ELjcdNzzXCZpFInIVQHo+aPeD4C2rGMJS8PIX97YAu47wH+ajvlvpJxMkYBcFICe9/kXUfqtv1PW8YSl4eTv3WYFuDNN54InUkunSMTgrAOwE2a3AIuA/0byU2D5ATcZWGr3PPnSdPIpkpLpGYCdMHs/YAkwOetEhKfh5e+//w7gM6bz3jcDJlUkJLMCYCfM/hDwU0oX7TQ4TSd/mV/j3AzT1b4uRFZFcjIpAHbC7DZgMbBL1gkIT9PKXx7nd8BHTVe7rijMIakXgJ7f/A8h+ftuN6b85RdPANNM10KdCeSMVAtAz3v+x9Bpf9/txpa/vPEAuBmma9HbHpIrPJHapwA9f+1fguTvu90c8gNuGnBdwsQKz6RSAHo+578F/bW/73bzyF/euNCOnnlO/NwK36R1BnARMCPryYZH8keI5Xo7emYT/CIoBsH/BmAnzN4HeBpd5IPk3/piKXCUWb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xXXAdHBPSv6mYBMwMwv5QWcAucUOnTQcWALuiG17JX+D0Q2ckJX8oDOA3GLefmkduI8Ad5T2SP4GYwVweJbyg84ACoEdOvFSSpcNDwEkf/FZApyT9h/8KqECUBDs0ImHArfh3ORteyV/wdgMzAHmhvyGXz2oABQIO2TCzsDXgUvBDdn2E8lfAB4CLjB0e3+4RxJUAAqIHfKe/YBrgBMlf+55gdKlvcG/2BMHFYACY4fsdRjwJRwzwfU6lpI/BzxDqUjPC/2V3iSoADQAdofxk4HzgHPA7bntJ5I/Zd6i9Ae+HwAP5uV9fjVUABoIu4PZATiG0oVEU4FDcAyS/EFZSemhHQ8S8O69oVABaGDs4HEjwU0BDgb2BzcJGA+MArcLIPmjsQVYA3QBfwWWU3pQ59K0vrYrhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCiMbi/wFvDkONfZ98cgAAAABJRU5ErkJggg==\">\n${cssContent ? `<style>${cssContent}</style>` : \"\"}\n</head>\n<body>\n<div id=\"app\"></div>\n<script>window.__STORYWRIGHT_SUMMARY__ = ${JSON.stringify(summary).replace(\n /</g,\n \"\\\\u003c\",\n )};</script>\n<script>${bundleJs}</script>\n</body>\n</html>`;\n}\n\nexport default StorywrightReporter;\n"],"mappings":";AAAA,OAAO,QAAQ;AACf,SAAS,qBAAqB;AAC9B,OAAO,UAAU;AAejB,IAAM,sBAAN,MAA8C;AAAA,EACpC;AAAA,EACA,UAAU,oBAAI,IASpB;AAAA,EACM,YAAY;AAAA,EAEpB,YAAY,UAAsC,CAAC,GAAG;AACpD,SAAK,YAAY,QAAQ,aAAa,KAAK,QAAQ,gBAAgB,QAAQ;AAAA,EAC7E;AAAA,EAEA,QAAQ,SAAqB,QAAqB;AAChD,SAAK,YAAY,KAAK,IAAI;AAAA,EAC5B;AAAA,EAEA,UAAU,MAAgB,QAA4B;AACpD,UAAM,UAAU,KAAK,QAAQ,QAAQ,GAAG,QAAQ;AAChD,UAAM,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;AAAA;AAAA;AAAA,2CAIP,KAAK,UAAU,OAAO,EAAE;AAAA,IAC/D;AAAA,IACA;AAAA,EACF,CAAC;AAAA,UACO,QAAQ;AAAA;AAAA;AAGlB;AAEA,IAAO,mBAAQ;","names":["require"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/config/index.ts","../src/config/defaults.ts","../src/config/types.ts","../src/notifier/report-url.ts","../src/notifier/ci-context.ts","../src/utils/logger.ts","../src/notifier/runner.ts","../src/reporter/cli-reporter.ts","../src/storage/local.ts","../src/storage/index.ts","../src/core/engine.ts","../src/playwright/config-generator.ts","../src/playwright/test-generator.ts","../src/resolver/index.ts","../src/utils/path.ts","../src/utils/process.ts","../src/core/storybook.ts"],"sourcesContent":["import { loadConfig as unconfigLoad } from \"unconfig\";\nimport { DEFAULT_CONFIG } from \"./defaults.js\";\nimport { STANDARD_BROWSERS } from \"./types.js\";\nimport type { DeepPartial, StorywrightConfig } from \"./types.js\";\n\nexport function defineConfig(\n config: DeepPartial<StorywrightConfig>,\n): DeepPartial<StorywrightConfig> {\n return config;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction deepMerge(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = { ...target };\n for (const key of Object.keys(source)) {\n const sourceVal = source[key];\n const targetVal = result[key];\n if (isPlainObject(sourceVal) && isPlainObject(targetVal)) {\n result[key] = deepMerge(targetVal, sourceVal);\n } else if (sourceVal !== undefined) {\n result[key] = sourceVal;\n }\n }\n return result;\n}\n\nexport async function loadConfig(\n cwd: string = process.cwd(),\n overrides?: DeepPartial<StorywrightConfig>,\n): Promise<StorywrightConfig> {\n const { config: userConfig } = await unconfigLoad<DeepPartial<StorywrightConfig>>({\n sources: [\n {\n files: \"storywright.config\",\n extensions: [\"ts\", \"js\", \"mjs\"],\n },\n ],\n cwd,\n });\n\n let merged = DEFAULT_CONFIG as unknown as Record<string, unknown>;\n if (userConfig) {\n merged = deepMerge(merged, userConfig as Record<string, unknown>);\n }\n if (overrides) {\n merged = deepMerge(merged, overrides as Record<string, unknown>);\n }\n const result = merged as unknown as StorywrightConfig;\n validateConfig(result);\n return result;\n}\n\nfunction validateConfig(config: StorywrightConfig): void {\n for (const browser of config.browsers) {\n const options = config.browserOptions[browser];\n\n if (!STANDARD_BROWSERS.has(browser) && !options?.browserName) {\n throw new Error(\n `Custom browser project '${browser}' requires 'browserName' in browserOptions.\\nExample:\\n browserOptions: {\\n '${browser}': { browserName: 'webkit', ... }\\n }\\nValid browserName values: 'chromium', 'firefox', 'webkit'.\\n\\nError code: SW_E_MISSING_BROWSER_NAME`,\n );\n }\n\n if (options?.browserName && !STANDARD_BROWSERS.has(options.browserName)) {\n throw new Error(\n `Invalid browserName '${options.browserName}' for browser project '${browser}'.\\nValid values: 'chromium', 'firefox', 'webkit'.\\n\\nError code: SW_E_INVALID_BROWSER_NAME`,\n );\n }\n }\n}\n\nexport type { StorywrightConfig, DeepPartial } from \"./types.js\";\n","import type { StorywrightConfig } from \"./types.js\";\n\nexport const DEFAULT_CONFIG: StorywrightConfig = {\n storybook: {\n staticDir: \"storybook-static\",\n buildCommand: \"npx storybook build --stats-json\",\n url: undefined,\n compatibility: \"auto\",\n },\n\n browsers: [\"chromium\"],\n browserOptions: {},\n\n screenshot: {\n fullPage: true,\n animations: \"disabled\",\n threshold: 0.02,\n maxDiffPixelRatio: 0.02,\n freezeTime: \"2024-01-01T00:00:00\",\n timezone: \"UTC\",\n locale: \"en-US\",\n seed: 1,\n },\n\n diffDetection: {\n enabled: true,\n watchFiles: [\"package.json\", \"package-lock.json\", \".storybook/**/*\"],\n baseBranch: \"main\",\n baseBranchDiffDepth: 1,\n },\n\n storage: {\n provider: \"local\",\n branch: \"main\",\n local: {\n baselineDir: \".storywright/baselines\",\n },\n s3: {\n bucket: \"\",\n prefix: \"storywright/baselines\",\n region: \"ap-northeast-1\",\n compression: \"zstd\",\n },\n },\n\n report: {\n outputDir: \".storywright/report\",\n title: \"Storywright Report\",\n },\n\n workers: \"auto\",\n retries: 0,\n\n timeout: {\n test: 30000,\n navigation: 20000,\n expect: 10000,\n },\n\n include: [\"**\"],\n exclude: [],\n\n hooks: {},\n\n notifiers: [],\n};\n","import type { Page } from \"@playwright/test\";\nimport type { Notifier } from \"../notifier/types.js\";\n\nexport interface StorywrightConfig {\n storybook: StorybookConfig;\n browsers: BrowserName[];\n browserOptions: Record<string, BrowserOption>;\n screenshot: ScreenshotConfig;\n diffDetection: DiffDetectionConfig;\n storage: StorageConfig;\n report: ReportConfig;\n workers: number | \"auto\";\n retries: number;\n timeout: TimeoutConfig;\n include: string[];\n exclude: string[];\n hooks: HooksConfig;\n notifiers: Notifier[];\n}\n\nexport type BrowserName = \"chromium\" | \"firefox\" | \"webkit\" | (string & {});\n\nexport type PlaywrightBrowserName = \"chromium\" | \"firefox\" | \"webkit\";\n\nexport const STANDARD_BROWSERS: ReadonlySet<string> = new Set<PlaywrightBrowserName>([\n \"chromium\",\n \"firefox\",\n \"webkit\",\n]);\n\nexport interface BrowserOption {\n browserName?: PlaywrightBrowserName;\n viewport?: { width: number; height: number };\n deviceScaleFactor?: number;\n isMobile?: boolean;\n hasTouch?: boolean;\n userAgent?: string;\n exclude?: string[];\n}\n\nexport interface StorybookConfig {\n staticDir: string;\n buildCommand: string;\n url?: string;\n compatibility: \"auto\" | \"v8\";\n}\n\nexport interface ScreenshotConfig {\n fullPage: boolean;\n animations: \"disabled\" | \"allow\";\n threshold: number;\n maxDiffPixelRatio: number;\n freezeTime: string;\n timezone: string;\n locale: string;\n seed: number;\n}\n\nexport interface DiffDetectionConfig {\n enabled: boolean;\n watchFiles: string[];\n baseBranch: string;\n baseBranchDiffDepth: number;\n}\n\nexport interface StorageConfig {\n provider: \"local\" | \"s3\";\n branch: string;\n local: LocalStorageConfig;\n s3: S3StorageConfig;\n}\n\nexport interface LocalStorageConfig {\n baselineDir: string;\n}\n\nexport interface S3StorageConfig {\n bucket: string;\n prefix: string;\n region: string;\n compression: \"zstd\" | \"gzip\" | \"none\";\n}\n\nexport interface ReportConfig {\n outputDir: string;\n title: string;\n url?: string;\n}\n\nexport interface TimeoutConfig {\n test: number;\n navigation: number;\n expect: number;\n}\n\nexport interface StoryContext {\n id: string;\n title: string;\n name: string;\n}\n\nexport interface HooksConfig {\n beforeScreenshot?: (page: Page, story: StoryContext) => Promise<void>;\n afterScreenshot?: (page: Page, story: StoryContext) => Promise<void>;\n}\n\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n","export interface ReportUrlContext {\n prNumber?: number;\n branch: string;\n sha: string;\n shortSha: string;\n timestamp: string;\n}\n\nexport function resolveReportUrl(template: string, ctx: ReportUrlContext): string {\n return template\n .replace(/\\$\\{prNumber\\}/g, ctx.prNumber != null ? String(ctx.prNumber) : \"\")\n .replace(/\\$\\{branch\\}/g, encodeURIComponent(ctx.branch))\n .replace(/\\$\\{sha\\}/g, ctx.sha)\n .replace(/\\$\\{shortSha\\}/g, ctx.shortSha)\n .replace(/\\$\\{timestamp\\}/g, ctx.timestamp);\n}\n","import { execSync } from \"node:child_process\";\n\nexport interface CIContext {\n provider: \"github-actions\" | \"circleci\" | \"generic\" | \"local\";\n prNumber?: number;\n branch: string;\n sha: string;\n shortSha: string;\n timestamp: string;\n repository?: string;\n token?: string;\n}\n\nexport interface CIContextOverrides {\n prNumber?: number;\n branch?: string;\n sha?: string;\n repository?: string;\n token?: string;\n}\n\nexport function detectCIContext(overrides?: CIContextOverrides): CIContext {\n const base = detectFromEnvironment();\n\n const sha = overrides?.sha ?? base.sha;\n return {\n ...base,\n ...stripUndefined(overrides),\n sha,\n shortSha: sha.slice(0, 7),\n };\n}\n\nfunction detectFromEnvironment(): CIContext {\n const timestamp = formatTimestamp(new Date());\n\n if (process.env.GITHUB_ACTIONS) {\n return {\n provider: \"github-actions\",\n token: process.env.GITHUB_TOKEN,\n repository: process.env.GITHUB_REPOSITORY,\n prNumber: extractPrFromGitHubRef(process.env.GITHUB_REF),\n branch: process.env.GITHUB_HEAD_REF || gitBranch(),\n sha: process.env.GITHUB_SHA || gitSha(),\n shortSha: (process.env.GITHUB_SHA || gitSha()).slice(0, 7),\n timestamp,\n };\n }\n\n if (process.env.CIRCLECI) {\n return {\n provider: \"circleci\",\n token: process.env.GITHUB_TOKEN,\n repository: buildCircleCIRepository(),\n prNumber: extractPrFromUrl(process.env.CIRCLE_PULL_REQUEST),\n branch: process.env.CIRCLE_BRANCH || gitBranch(),\n sha: process.env.CIRCLE_SHA1 || gitSha(),\n shortSha: (process.env.CIRCLE_SHA1 || gitSha()).slice(0, 7),\n timestamp,\n };\n }\n\n if (process.env.STORYWRIGHT_PR_NUMBER) {\n return {\n provider: \"generic\",\n token: process.env.STORYWRIGHT_GITHUB_TOKEN,\n repository: process.env.STORYWRIGHT_GITHUB_REPO,\n prNumber: Number(process.env.STORYWRIGHT_PR_NUMBER),\n branch: gitBranch(),\n sha: gitSha(),\n shortSha: gitSha().slice(0, 7),\n timestamp,\n };\n }\n\n return {\n provider: \"local\",\n branch: gitBranch(),\n sha: gitSha(),\n shortSha: gitSha().slice(0, 7),\n timestamp,\n };\n}\n\nexport function extractPrFromGitHubRef(ref?: string): number | undefined {\n if (!ref) return undefined;\n const match = ref.match(/^refs\\/pull\\/(\\d+)\\//);\n return match ? Number(match[1]) : undefined;\n}\n\nexport function extractPrFromUrl(url?: string): number | undefined {\n if (!url) return undefined;\n const match = url.match(/\\/pull\\/(\\d+)/);\n return match ? Number(match[1]) : undefined;\n}\n\nfunction buildCircleCIRepository(): string | undefined {\n const user = process.env.CIRCLE_PROJECT_USERNAME;\n const repo = process.env.CIRCLE_PROJECT_REPONAME;\n return user && repo ? `${user}/${repo}` : undefined;\n}\n\nfunction gitBranch(): string {\n try {\n return execSync(\"git branch --show-current\", { encoding: \"utf-8\" }).trim();\n } catch {\n return \"unknown\";\n }\n}\n\nfunction gitSha(): string {\n try {\n return execSync(\"git rev-parse HEAD\", { encoding: \"utf-8\" }).trim();\n } catch {\n return \"0000000000000000000000000000000000000000\";\n }\n}\n\nfunction formatTimestamp(date: Date): string {\n return date\n .toISOString()\n .replace(/[-:]/g, \"\")\n .replace(/\\.\\d+Z$/, \"\");\n}\n\nfunction stripUndefined(obj?: CIContextOverrides): Partial<CIContext> {\n if (!obj) return {};\n const result: Partial<CIContext> = {};\n if (obj.prNumber !== undefined) result.prNumber = obj.prNumber;\n if (obj.branch !== undefined) result.branch = obj.branch;\n if (obj.sha !== undefined) result.sha = obj.sha;\n if (obj.repository !== undefined) result.repository = obj.repository;\n if (obj.token !== undefined) result.token = obj.token;\n return result;\n}\n","import { createConsola } from \"consola\";\n\nconst isCI = !!(\n process.env.CI ||\n process.env.GITHUB_ACTIONS ||\n process.env.CIRCLECI ||\n process.env.GITLAB_CI\n);\n\nexport const logger = createConsola({\n level: process.env.STORYWRIGHT_DEBUG ? 5 : 3,\n});\n\nexport { isCI };\n","import { logger } from \"../utils/logger.js\";\nimport type { NotificationContext, Notifier } from \"./types.js\";\n\nexport async function runNotifiers(\n notifiers: Notifier[],\n context: NotificationContext,\n): Promise<void> {\n for (const notifier of notifiers) {\n try {\n const result = await notifier.notify(context);\n if (result.posted) {\n logger.success(`Notification sent: ${notifier.name}`);\n } else if (result.skipped) {\n logger.info(`Notification skipped: ${notifier.name} (${result.skipped})`);\n }\n } catch (error) {\n logger.warn(\n `Notification failed: ${notifier.name}`,\n error instanceof Error ? error.message : error,\n );\n }\n }\n}\n","import type { TestSummary } from \"../core/types.js\";\n\nexport function formatSummary(summary: TestSummary, options?: { reportPath?: string }): string {\n const durationSec = Math.round(summary.duration / 1000);\n const minutes = Math.floor(durationSec / 60);\n const seconds = durationSec % 60;\n const durationStr = minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;\n\n const lines: string[] = [\n \"\",\n \"Storywright Results\",\n \"\\u2550\".repeat(42),\n ` Total: ${summary.total} Passed: ${summary.passed} Failed: ${summary.failed} Skipped: ${summary.skipped}`,\n ` Duration: ${durationStr}`,\n ` Browsers: ${summary.browsers.join(\", \")}`,\n ];\n\n const newFailures = summary.entries.filter((f) => f.type === \"new\");\n const diffFailures = summary.entries.filter((f) => f.type === \"diff\");\n\n if (newFailures.length > 0) {\n lines.push(\"\");\n lines.push(\" New (no baseline):\");\n for (const failure of newFailures) {\n lines.push(` \\u25cb ${failure.story}: ${failure.variant} (${failure.browser})`);\n }\n }\n\n if (diffFailures.length > 0) {\n lines.push(\"\");\n lines.push(\" Failed:\");\n for (const failure of diffFailures) {\n lines.push(` \\u2717 ${failure.story}: ${failure.variant} (${failure.browser})`);\n if (failure.diffRatio > 0) {\n const pct = (failure.diffRatio * 100).toFixed(1);\n lines.push(` \\u2192 Diff: ${pct}% pixels changed`);\n }\n }\n }\n\n const reportPath = options?.reportPath ?? \".storywright/report/index.html\";\n lines.push(\"\");\n lines.push(` Report: ${reportPath}`);\n lines.push(\"\\u2550\".repeat(42));\n lines.push(\"\");\n\n return lines.join(\"\\n\");\n}\n","import { execFile } from \"node:child_process\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { promisify } from \"node:util\";\nimport type { DownloadOptions, StorageAdapter, UploadOptions } from \"./types.js\";\n\nconst execFileAsync = promisify(execFile);\n\nexport class LocalStorageAdapter implements StorageAdapter {\n constructor(private readonly baselineDir: string) {}\n\n async download(options: DownloadOptions): Promise<void> {\n try {\n await fs.access(this.baselineDir);\n } catch {\n return;\n }\n await fs.cp(this.baselineDir, options.destDir, { recursive: true });\n }\n\n async upload(options: UploadOptions): Promise<void> {\n const resolvedSource = path.resolve(options.sourceDir);\n const resolvedDest = path.resolve(this.baselineDir);\n if (resolvedSource === resolvedDest) {\n return;\n }\n await fs.mkdir(this.baselineDir, { recursive: true });\n await fs.cp(options.sourceDir, this.baselineDir, { recursive: true });\n }\n\n async exists(_branch: string): Promise<boolean> {\n try {\n await fs.access(this.baselineDir);\n const entries = await fs.readdir(this.baselineDir);\n return entries.length > 0;\n } catch {\n return false;\n }\n }\n\n /**\n * Extract baselines from a git branch using `git ls-tree` + `git show`.\n * Binary-safe (PNG files) via `encoding: 'buffer'`.\n */\n async downloadFromGit(branch: string, destDir: string, cwd: string): Promise<void> {\n const gitPath = this.baselineDir.split(path.sep).join(\"/\");\n\n let lsOutput: string;\n try {\n const result = await execFileAsync(\n \"git\",\n [\"ls-tree\", \"-r\", \"--name-only\", branch, \"--\", gitPath],\n { cwd },\n );\n lsOutput = result.stdout;\n } catch (error) {\n throw new Error(\n `Failed to list baselines from git branch '${branch}': ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n const files = lsOutput.trim().split(\"\\n\").filter(Boolean);\n if (files.length === 0) {\n return;\n }\n\n await fs.mkdir(destDir, { recursive: true });\n\n const posixBaselineDir = this.baselineDir.split(path.sep).join(\"/\").replace(/\\/+$/, \"\");\n\n for (const file of files) {\n let content: Buffer;\n try {\n const result = await execFileAsync(\"git\", [\"show\", `${branch}:${file}`], {\n cwd,\n encoding: \"buffer\" as unknown as BufferEncoding,\n maxBuffer: 50 * 1024 * 1024,\n });\n content = result.stdout as unknown as Buffer;\n } catch (error) {\n throw new Error(\n `Failed to extract '${file}' from git branch '${branch}': ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n const relativePath = file.slice(posixBaselineDir.length + 1);\n const destPath = path.join(destDir, ...relativePath.split(\"/\"));\n await fs.mkdir(path.dirname(destPath), { recursive: true });\n await fs.writeFile(destPath, content);\n }\n }\n}\n","import type { StorageConfig } from \"../config/types.js\";\nimport { LocalStorageAdapter } from \"./local.js\";\nimport type { StorageAdapter } from \"./types.js\";\n\nexport async function createStorageAdapter(config: StorageConfig): Promise<StorageAdapter> {\n switch (config.provider) {\n case \"local\":\n return new LocalStorageAdapter(config.local.baselineDir);\n case \"s3\":\n return await loadS3Adapter(config);\n default:\n throw new Error(`Unknown storage provider: ${String(config.provider)}`);\n }\n}\n\nasync function loadS3Adapter(config: StorageConfig): Promise<StorageAdapter> {\n try {\n const { S3StorageAdapter } = await import(\"@storywright/storage-s3\");\n return new S3StorageAdapter(config.s3) as StorageAdapter;\n } catch {\n throw new Error(\n \"S3 storage adapter requires the @storywright/storage-s3 package.\\nInstall it with: pnpm add @storywright/storage-s3\",\n );\n }\n}\n\nexport type { StorageAdapter, DownloadOptions, UploadOptions } from \"./types.js\";\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport type { StorywrightConfig } from \"../config/types.js\";\nimport { generatePlaywrightConfig } from \"../playwright/config-generator.js\";\nimport { generateTestFile } from \"../playwright/test-generator.js\";\nimport { resolveAffectedStories } from \"../resolver/index.js\";\nimport { createStorageAdapter } from \"../storage/index.js\";\nimport { logger } from \"../utils/logger.js\";\nimport { resolveOutputDir } from \"../utils/path.js\";\nimport { exec } from \"../utils/process.js\";\nimport {\n buildStorybook,\n discoverStories,\n excludeStoriesForBrowser,\n filterStories,\n} from \"./storybook.js\";\nimport type { Story, StoryIndex, TestSummary } from \"./types.js\";\n\nexport interface TestOptions {\n diffOnly?: boolean;\n shard?: string;\n updateSnapshots?: boolean;\n filter?: string;\n outputDir?: string;\n reporters?: string[];\n}\n\nexport interface TestRunResult {\n exitCode: number;\n summary?: TestSummary;\n reportDir?: string;\n snapshotDir?: string;\n}\n\nconst STORIES_PER_FILE = 50;\n\nfunction resolveReporterPath(): string {\n // Resolve relative to this file's dist location\n const thisDir = new URL(\".\", import.meta.url).pathname;\n return path.resolve(thisDir, \"playwright\", \"reporter.js\");\n}\n\nfunction chunkStories(entries: Record<string, Story>): Record<string, Story>[] {\n const keys = Object.keys(entries);\n if (keys.length === 0) return [{}];\n const chunks: Record<string, Story>[] = [];\n for (let i = 0; i < keys.length; i += STORIES_PER_FILE) {\n const chunk: Record<string, Story> = {};\n for (const key of keys.slice(i, i + STORIES_PER_FILE)) {\n chunk[key] = entries[key];\n }\n chunks.push(chunk);\n }\n return chunks;\n}\n\nexport async function runTests(\n config: StorywrightConfig,\n options: TestOptions = {},\n cwd: string = process.cwd(),\n): Promise<TestRunResult> {\n const outputRoot = options.outputDir\n ? path.resolve(cwd, options.outputDir)\n : resolveOutputDir(cwd, \".storywright\");\n const tmpDir = path.join(outputRoot, \"tmp\");\n const reportDir = options.outputDir\n ? path.join(outputRoot, \"report\")\n : path.resolve(cwd, config.report.outputDir);\n const storybookDir = path.resolve(cwd, config.storybook.staticDir);\n const snapshotDir = path.join(tmpDir, \"snapshots\");\n\n // Prepare directories early for parallel operations\n await fs.mkdir(snapshotDir, { recursive: true });\n\n // Start baseline download in parallel with Storybook build\n // Skip download when updating snapshots (update command) — baselines are regenerated\n let baselinePromise: Promise<void> | undefined;\n if (!options.updateSnapshots) {\n const storage = await createStorageAdapter(config.storage);\n baselinePromise = storage\n .download({\n branch: config.storage.branch,\n destDir: snapshotDir,\n onProgress: (msg) => logger.info(msg),\n })\n .catch(() => {\n logger.info(\"No existing baselines found\");\n });\n }\n\n // 1. Build Storybook if needed\n await buildStorybook(config, cwd);\n\n // 2. Discover & filter stories\n logger.start(\"Discovering stories...\");\n const allStories = await discoverStories(config, cwd);\n let targetStories = filterStories(allStories, config);\n\n // Apply --filter option\n if (options.filter) {\n targetStories = applyFilter(targetStories, options.filter);\n }\n\n logger.info(`${Object.keys(targetStories.entries).length} stories found`);\n\n // 3. Diff-only: resolve affected stories (default in CI)\n const effectiveDiffOnly = options.diffOnly ?? !!process.env.CI;\n if (effectiveDiffOnly && config.diffDetection.enabled) {\n logger.start(\"Resolving dependencies...\");\n const diffResult = await resolveAffectedStories(\n targetStories,\n config.diffDetection,\n storybookDir,\n cwd,\n );\n if (!diffResult.allStories) {\n targetStories = diffResult.targetStories;\n }\n logger.info(`${Object.keys(targetStories.entries).length} stories affected by changes`);\n }\n\n // 4. Wait for baseline download to complete\n await baselinePromise;\n\n // 5. Generate split test files for better worker distribution\n let testFilePattern: string;\n let testMatchByBrowser: Record<string, string> | undefined;\n\n const browserExcludesExist = config.browsers.some(\n (b) => (config.browserOptions[b]?.exclude ?? []).length > 0,\n );\n\n if (browserExcludesExist) {\n // Generate per-browser test files when any browser has specific excludes\n testMatchByBrowser = {};\n\n for (const browser of config.browsers) {\n const browserExclude = config.browserOptions[browser]?.exclude ?? [];\n const browserStories = excludeStoriesForBrowser(targetStories, browserExclude);\n\n if (Object.keys(browserStories.entries).length === 0) {\n logger.warn(\n `${browser}: All stories excluded by browser-specific 'exclude' patterns. No tests will run for this browser.`,\n );\n }\n\n const browserChunks = chunkStories(browserStories.entries);\n\n testMatchByBrowser[browser] =\n browserChunks.length === 1\n ? `storywright-${browser}-0.spec.ts`\n : `storywright-${browser}-*.spec.ts`;\n\n for (let i = 0; i < browserChunks.length; i++) {\n const chunkIndex: StoryIndex = {\n ...browserStories,\n entries: browserChunks[i],\n };\n const chunkPath = path.join(tmpDir, `target-stories-${browser}-${i}.json`);\n await fs.writeFile(chunkPath, JSON.stringify(chunkIndex));\n\n const testContent = generateTestFile(config.screenshot, {\n targetStoriesPath: chunkPath.replace(/\\\\/g, \"/\"),\n });\n await fs.writeFile(path.join(tmpDir, `storywright-${browser}-${i}.spec.ts`), testContent);\n }\n\n logger.info(\n `${browser}: ${Object.keys(browserStories.entries).length} stories, ${\n browserChunks.length\n } test file(s)`,\n );\n }\n\n testFilePattern = \"storywright-*.spec.ts\";\n } else {\n // Default: shared test files for all browsers\n const chunks = chunkStories(targetStories.entries);\n testFilePattern = chunks.length === 1 ? \"storywright-0.spec.ts\" : \"storywright-*.spec.ts\";\n\n for (let i = 0; i < chunks.length; i++) {\n const chunkIndex: StoryIndex = { ...targetStories, entries: chunks[i] };\n const chunkPath = path.join(tmpDir, `target-stories-${i}.json`);\n await fs.writeFile(chunkPath, JSON.stringify(chunkIndex));\n\n const testContent = generateTestFile(config.screenshot, {\n targetStoriesPath: chunkPath.replace(/\\\\/g, \"/\"),\n });\n await fs.writeFile(path.join(tmpDir, `storywright-${i}.spec.ts`), testContent);\n }\n\n logger.info(`${chunks.length} test file(s) generated`);\n }\n\n // 6. Generate Playwright config\n const reporterWrapperPath = path.join(tmpDir, \"reporter.mjs\");\n const resolvedReporterPath = resolveReporterPath().replace(/\\\\/g, \"/\");\n const reporterOutputDir = reportDir.replace(/\\\\/g, \"/\");\n\n await fs.writeFile(\n reporterWrapperPath,\n `import StorywrightReporter from '${resolvedReporterPath}';\\nexport default class extends StorywrightReporter {\\n constructor() { super({ outputDir: '${reporterOutputDir}' }); }\\n}\\n`,\n );\n\n // Determine Storybook URL\n let actualStorybookUrl = config.storybook.url;\n const needsServer = !actualStorybookUrl;\n\n if (needsServer) {\n actualStorybookUrl = \"http://localhost:6007\";\n }\n\n const playwrightConfig = generatePlaywrightConfig(config, {\n tmpDir: tmpDir.replace(/\\\\/g, \"/\"),\n storybookUrl: actualStorybookUrl ?? \"http://localhost:6007\",\n snapshotDir: snapshotDir.replace(/\\\\/g, \"/\"),\n reporterPath: reporterWrapperPath.replace(/\\\\/g, \"/\"),\n testMatch: testFilePattern,\n testMatchByBrowser,\n shard: options.shard,\n reporters: options.reporters,\n updateSnapshots: options.updateSnapshots,\n });\n\n const configPath = path.join(tmpDir, \"playwright.config.ts\");\n await fs.writeFile(configPath, playwrightConfig);\n\n // 7. Run Playwright tests\n logger.start(\"Running tests...\");\n const args = [\"playwright\", \"test\", \"--config\", configPath];\n\n if (options.updateSnapshots) {\n args.push(\"--update-snapshots\");\n }\n\n // Start static server if needed\n let serverProc: { kill: () => void } | undefined;\n if (needsServer) {\n serverProc = await startStaticServer(storybookDir, 6007);\n }\n\n try {\n const result = await exec(\"npx\", args, { cwd, inherit: true });\n\n // 8. Read results\n let summary: TestSummary | undefined;\n try {\n const summaryPath = path.join(reportDir, \"summary.json\");\n const summaryContent = await fs.readFile(summaryPath, \"utf-8\");\n summary = JSON.parse(summaryContent);\n } catch {\n // summary may not exist if no tests ran\n }\n\n // 9. Map exit codes per SPEC §14.2\n const exitCode = mapExitCode(result.exitCode, summary);\n\n return { exitCode, summary, reportDir, snapshotDir };\n } finally {\n serverProc?.kill();\n }\n}\n\nexport async function updateBaselines(\n config: StorywrightConfig,\n options: {\n all?: boolean;\n upload?: boolean;\n shard?: string;\n filter?: string;\n } = {},\n cwd: string = process.cwd(),\n): Promise<TestRunResult> {\n const result = await runTests(\n config,\n {\n updateSnapshots: true,\n diffOnly: !options.all,\n shard: options.shard,\n filter: options.filter,\n },\n cwd,\n );\n\n if (result.exitCode !== 0) {\n logger.warn(\"Some tests failed during baseline update\");\n }\n\n // Save updated snapshots back to baselineDir (local disk operation)\n if (result.snapshotDir) {\n const baselineDir = path.resolve(cwd, config.storage.local.baselineDir);\n await fs.mkdir(baselineDir, { recursive: true });\n await fs.cp(result.snapshotDir, baselineDir, { recursive: true });\n logger.success(`Baselines saved to ${config.storage.local.baselineDir}`);\n }\n\n // --upload: upload to remote storage (S3 etc.) only when explicitly requested\n if (options.upload) {\n const storage = await createStorageAdapter(config.storage);\n const baselineDir = path.resolve(cwd, config.storage.local.baselineDir);\n await storage.upload({\n branch: config.storage.branch,\n sourceDir: baselineDir,\n shard: options.shard,\n onProgress: (msg) => logger.info(msg),\n });\n logger.success(\"Baselines uploaded to remote storage\");\n }\n\n return result;\n}\n\nfunction applyFilter(storyIndex: StoryIndex, filter: string): StoryIndex {\n const matcher = picomatch(filter);\n const entries: Record<string, StoryIndex[\"entries\"][string]> = {};\n for (const [id, story] of Object.entries(storyIndex.entries)) {\n const fullName = `${story.title}/${story.name}`;\n if (matcher(fullName) || matcher(story.title) || matcher(story.id)) {\n entries[id] = story;\n }\n }\n return { ...storyIndex, entries };\n}\n\nfunction mapExitCode(playwrightCode: number, summary?: TestSummary): number {\n // SPEC §14.2: 0 = success (no diff), 1 = success (diff found), 2 = execution error, 130 = SIGINT\n if (playwrightCode === 130 || playwrightCode === 143) {\n return 130; // SIGINT / SIGTERM\n }\n if (summary) {\n if (summary.failed > 0) return 1;\n if (summary.total === 0 && playwrightCode !== 0) return 2;\n return 0;\n }\n // No summary = likely execution error\n return playwrightCode === 0 ? 0 : 2;\n}\n\nasync function startStaticServer(dir: string, port: number): Promise<{ kill: () => void }> {\n const { createServer } = await import(\"node:http\");\n const sirv = (await import(\"sirv\")).default;\n\n const handler = sirv(dir, { single: false, dev: false });\n const server = createServer(handler);\n\n await new Promise<void>((resolve, reject) => {\n server.on(\"error\", reject);\n server.listen(port, () => resolve());\n });\n\n return { kill: () => server.close() };\n}\n","import { STANDARD_BROWSERS } from \"../config/types.js\";\nimport type { BrowserOption, StorywrightConfig } from \"../config/types.js\";\n\nexport function generatePlaywrightConfig(\n config: StorywrightConfig,\n options: {\n tmpDir: string;\n storybookUrl: string;\n snapshotDir: string;\n reporterPath: string;\n testMatch: string;\n testMatchByBrowser?: Record<string, string>;\n shard?: string;\n reporters?: string[];\n updateSnapshots?: boolean;\n },\n): string {\n const projects = config.browsers.map((browser) => {\n const rawOptions = config.browserOptions[browser];\n const useObj = buildBrowserUseObject(browser, rawOptions);\n const useStr = JSON.stringify(useObj, null, \"\\t\\t\");\n const testMatch = options.testMatchByBrowser?.[browser];\n const testMatchLine = testMatch ? `\\n\\t\\t\\ttestMatch: '${escapeBackslash(testMatch)}',` : \"\";\n return `\\t\\t{\n\\t\\t\\tname: '${browser}',${testMatchLine}\n\\t\\t\\tuse: ${useStr},\n\\t\\t}`;\n });\n\n const workers = config.workers === \"auto\" ? \"'100%'\" : String(config.workers);\n\n const shard = options.shard\n ? `\\tshard: { current: ${options.shard.split(\"/\")[0]}, total: ${options.shard.split(\"/\")[1]} },`\n : \"\";\n\n // Build reporter list: always include custom reporter, plus user-requested ones\n const reporterEntries: string[] = [];\n const requestedReporters = options.reporters ?? [\"default\", \"html\"];\n for (const r of requestedReporters) {\n if (r === \"default\" || r === \"list\") {\n reporterEntries.push(\"\\t\\t['list']\");\n } else if (r !== \"html\") {\n // Pass through other built-in Playwright reporters (dot, json, junit, etc.)\n reporterEntries.push(`\\t\\t['${r}']`);\n }\n }\n // Always include custom storywright reporter\n reporterEntries.push(`\\t\\t['${escapeBackslash(options.reporterPath)}']`);\n\n const testMatchLine = options.testMatchByBrowser\n ? \"\"\n : `\\ttestMatch: '${escapeBackslash(options.testMatch)}',\\n`;\n\n return `import { defineConfig } from '@playwright/test';\n\nexport default defineConfig({\n\\ttestDir: '${escapeBackslash(options.tmpDir)}',\n${testMatchLine}\\tsnapshotDir: '${escapeBackslash(options.snapshotDir)}',\n\\tsnapshotPathTemplate: '{snapshotDir}/{arg}-{projectName}{ext}',\n\\ttimeout: ${config.timeout.test},\n\\tupdateSnapshots: '${options.updateSnapshots ? \"all\" : \"none\"}',\n\\texpect: {\n\\t\\ttoHaveScreenshot: {\n\\t\\t\\tmaxDiffPixelRatio: ${config.screenshot.maxDiffPixelRatio},\n\\t\\t\\tthreshold: ${config.screenshot.threshold},\n\\t\\t},\n\\t\\ttimeout: ${config.timeout.expect},\n\\t},\n\\tfullyParallel: true,\n\\tforbidOnly: !!process.env.CI,\n\\tretries: ${config.retries},\n\\tworkers: ${workers},\n${shard}\n\\treporter: [\n${reporterEntries.join(\",\\n\")}\n\\t],\n\\tuse: {\n\\t\\tbaseURL: '${options.storybookUrl}',\n\\t\\tnavigationTimeout: ${config.timeout.navigation},\n\\t\\ttimezoneId: '${config.screenshot.timezone}',\n\\t\\tlocale: '${config.screenshot.locale}',\n\\t},\n\\tprojects: [\n${projects.join(\",\\n\")}\n\\t],\n});\n`;\n}\n\nfunction buildBrowserUseObject(\n browser: string,\n rawOptions?: BrowserOption,\n): Record<string, unknown> {\n let browserName: string;\n if (rawOptions?.browserName) {\n browserName = rawOptions.browserName;\n } else if (STANDARD_BROWSERS.has(browser)) {\n browserName = browser;\n } else {\n throw new Error(\n `Cannot resolve browserName for custom browser project '${browser}'.\\n\\nError code: SW_E_INTERNAL_BROWSER_RESOLVE`,\n );\n }\n const useObj: Record<string, unknown> = { browserName };\n\n if (rawOptions) {\n const { browserName: _, exclude: __, ...rest } = rawOptions;\n Object.assign(useObj, rest);\n }\n\n return useObj;\n}\n\nfunction escapeBackslash(str: string): string {\n return str.replace(/\\\\/g, \"/\");\n}\n","import type { ScreenshotConfig } from \"../config/types.js\";\n\nexport function generateTestFile(\n config: ScreenshotConfig,\n options: {\n targetStoriesPath: string;\n },\n): string {\n const disableAnimations = config.animations === \"disabled\";\n\n return `import { test, expect } from '@playwright/test';\nimport { readFileSync } from 'node:fs';\nimport { initPage, stabilizePage } from '@storywright/cli/playwright/stabilize';\n\nconst targetList = JSON.parse(\n\\treadFileSync('${escapeBackslash(options.targetStoriesPath)}', 'utf-8'),\n);\n\nconst stabilizeOptions = {\n\\tfreezeTime: '${config.freezeTime}',\n\\tseed: ${config.seed},\n\\tdisableAnimations: ${disableAnimations},\n};\n\ntest.describe.parallel('visual regression testing', () => {\n\\tif (Object.keys(targetList.entries).length === 0) {\n\\t\\ttest('no stories to test', () => {\n\\t\\t\\texpect(true).toBeTruthy();\n\\t\\t});\n\\t}\n\n\\tfor (const story of Object.values(targetList.entries)) {\n\\t\\ttest(\\`\\${story.title}: \\${story.name}\\`, async ({ page }) => {\n\\t\\t\\tawait initPage(page, stabilizeOptions);\n\n\\t\\t\\tawait page.goto(\\`/iframe.html?id=\\${story.id}\\`, {\n\\t\\t\\t\\twaitUntil: 'domcontentloaded',\n\\t\\t\\t});\n\n\\t\\t\\tawait stabilizePage(page, stabilizeOptions);\n\n\\t\\t\\tawait expect(page).toHaveScreenshot(\n\\t\\t\\t\\t[story.title, \\`\\${story.id}.png\\`],\n\\t\\t\\t\\t{\n\\t\\t\\t\\t\\tanimations: '${config.animations}',\n\\t\\t\\t\\t\\tfullPage: ${config.fullPage},\n\\t\\t\\t\\t\\tthreshold: ${config.threshold},\n\\t\\t\\t\\t\\tmaxDiffPixelRatio: ${config.maxDiffPixelRatio},\n\\t\\t\\t\\t},\n\\t\\t\\t);\n\\t\\t});\n\\t}\n});\n`;\n}\n\nfunction escapeBackslash(str: string): string {\n return str.replace(/\\\\/g, \"/\");\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport { simpleGit } from \"simple-git\";\nimport type { DiffDetectionConfig } from \"../config/types.js\";\nimport type { StatsIndex, StatsModule, StoryIndex } from \"../core/types.js\";\nimport { logger } from \"../utils/logger.js\";\nimport { normalizePath, stripLeadingDotSlash } from \"../utils/path.js\";\n\nexport interface DependencyResolver {\n getDependencies(filePath: string): string[];\n getStoriesForFiles(pathList: string[]): StoryIndex;\n}\n\nconst STORY_FILE_PATTERNS = [\".stories.\", \".mdx\"];\n\nfunction isStoryFile(moduleName: string): boolean {\n return STORY_FILE_PATTERNS.some((p) => moduleName.includes(p));\n}\n\nexport class StorybookStatsDependencyResolver implements DependencyResolver {\n private moduleMap: Record<string, StatsModule>;\n\n constructor(\n private statsJson: StatsIndex,\n private storiesJson: StoryIndex,\n ) {\n this.moduleMap = {};\n for (const mod of statsJson.modules) {\n // Key by normalized name (primary) and normalized id (fallback)\n const normalizedName = normalizePath(mod.name);\n this.moduleMap[normalizedName] = mod;\n const normalizedId = normalizePath(mod.id);\n if (normalizedId !== normalizedName) {\n this.moduleMap[normalizedId] ??= mod;\n }\n }\n }\n\n getDependencies(filePath: string): string[] {\n const normalizedPath = normalizePath(filePath);\n const dependencies = this.collectDependencies(normalizedPath);\n\n if (this.moduleMap[normalizedPath]) {\n dependencies.add(normalizedPath);\n }\n\n return [...dependencies];\n }\n\n getStoriesForFiles(pathList: string[]): StoryIndex {\n const result: StoryIndex = { v: this.storiesJson.v, entries: {} };\n\n for (const filePath of pathList) {\n // Finding #2 + #3: lookup via normalized moduleMap (name primary, id fallback)\n const normalizedPath = normalizePath(filePath);\n const stats = this.moduleMap[normalizedPath];\n if (!stats) continue;\n\n // Finding #1: collect ALL story reasons, not just first\n const storyReasons = stats.reasons.filter((r) => isStoryFile(r.moduleName));\n for (const reason of storyReasons) {\n const normalizedImportPath = normalizePath(reason.moduleName);\n // Collect ALL matching story entries per reason\n for (const storyObj of Object.values(this.storiesJson.entries)) {\n if (storyObj.type !== \"story\") continue;\n if (normalizePath(storyObj.importPath) === normalizedImportPath) {\n result.entries[storyObj.id] = storyObj;\n }\n }\n }\n }\n\n return result;\n }\n\n private collectDependencies(name: string, result = new Set<string>()): Set<string> {\n const mod = this.moduleMap[normalizePath(name)];\n if (mod) {\n for (const reason of mod.reasons) {\n if (!result.has(reason.moduleName)) {\n result.add(reason.moduleName);\n this.collectDependencies(reason.moduleName, result);\n }\n }\n }\n return result;\n }\n}\n\nexport interface DiffResult {\n allStories: boolean;\n targetStories: StoryIndex;\n}\n\ninterface DiffFileEntry {\n file: string;\n from?: string;\n}\n\nexport async function resolveAffectedStories(\n storiesJson: StoryIndex,\n config: DiffDetectionConfig,\n storybookStaticDir: string,\n cwd: string,\n): Promise<DiffResult> {\n const git = simpleGit({ baseDir: cwd });\n\n // Get diff summary\n let diffEntries: DiffFileEntry[];\n try {\n // Detect if HEAD is on the base branch (e.g. main)\n const currentBranch = (await git.raw([\"rev-parse\", \"--abbrev-ref\", \"HEAD\"])).trim();\n const isOnBaseBranch = currentBranch === config.baseBranch;\n\n let diffBase: string;\n if (isOnBaseBranch && config.baseBranchDiffDepth > 0) {\n // On the base branch, merge-base == HEAD so diff would be empty.\n // Use HEAD~N to compare against the previous commit(s) instead.\n diffBase = `HEAD~${config.baseBranchDiffDepth}`;\n logger.info(`On base branch '${config.baseBranch}', using ${diffBase} for diff detection`);\n } else {\n const mergeBase = await git.raw([\"merge-base\", config.baseBranch, \"HEAD\"]);\n diffBase = mergeBase.trim();\n }\n\n const diff = await git.diffSummary([diffBase, \"HEAD\"]);\n diffEntries = diff.files.map((f) => ({\n file: f.file,\n // Handle renames: include both old and new paths\n from: \"from\" in f ? (f as { from: string }).from : undefined,\n }));\n } catch {\n logger.warn(\"Failed to resolve git diff, running all stories\");\n return { allStories: true, targetStories: storiesJson };\n }\n\n if (diffEntries.length === 0) {\n logger.info(\"No changed files detected\");\n return { allStories: false, targetStories: { v: storiesJson.v, entries: {} } };\n }\n\n // Collect all affected paths (including rename sources)\n const allPaths: string[] = [];\n for (const entry of diffEntries) {\n allPaths.push(entry.file);\n if (entry.from) {\n allPaths.push(entry.from);\n }\n }\n\n // Check watchFiles\n for (const file of allPaths) {\n for (const pattern of config.watchFiles) {\n if (picomatch(pattern)(file)) {\n logger.info(`Watch file changed: ${file}, running all stories`);\n return { allStories: true, targetStories: storiesJson };\n }\n }\n }\n\n // Load stats json for dependency resolution\n const statsPath = path.resolve(storybookStaticDir, \"preview-stats.json\");\n let statsJson: StatsIndex;\n try {\n statsJson = JSON.parse(await fs.readFile(statsPath, \"utf-8\"));\n } catch {\n logger.warn(\"preview-stats.json not found, running all stories\");\n return { allStories: true, targetStories: storiesJson };\n }\n\n const resolver = new StorybookStatsDependencyResolver(statsJson, storiesJson);\n const targetStories: StoryIndex = { v: storiesJson.v, entries: {} };\n\n // Direct story file matches (both .stories.* and .mdx)\n for (const file of allPaths) {\n const matchedStories = Object.values(storiesJson.entries).filter(\n (story) => stripLeadingDotSlash(story.importPath) === file,\n );\n for (const story of matchedStories) {\n targetStories.entries[story.id] = story;\n }\n }\n\n // Dependency-based matches\n for (const file of allPaths) {\n const deps = resolver.getDependencies(normalizePath(file));\n const depStories = resolver.getStoriesForFiles(deps);\n for (const [id, story] of Object.entries(depStories.entries)) {\n targetStories.entries[id] = story;\n }\n }\n\n logger.info(`Resolved ${Object.keys(targetStories.entries).length} affected stories`);\n return { allStories: false, targetStories };\n}\n","import path from \"node:path\";\n\nexport function normalizePath(filePath: string): string {\n const normalized = filePath.replace(/\\\\/g, \"/\");\n if (normalized.startsWith(\"./\")) {\n return normalized;\n }\n return `./${normalized}`;\n}\n\nexport function stripLeadingDotSlash(filePath: string): string {\n return filePath.replace(/^\\.\\//, \"\");\n}\n\nexport function resolveOutputDir(outputDir: string, ...segments: string[]): string {\n return path.resolve(outputDir, ...segments);\n}\n","import { spawn } from \"node:child_process\";\n\nexport interface ExecResult {\n exitCode: number;\n stdout: string;\n stderr: string;\n}\n\nexport function exec(\n command: string,\n args: string[],\n options?: { cwd?: string; env?: Record<string, string>; inherit?: boolean },\n): Promise<ExecResult> {\n return new Promise((resolve, reject) => {\n const proc = spawn(command, args, {\n cwd: options?.cwd,\n env: { ...process.env, ...options?.env },\n stdio: options?.inherit ? [\"ignore\", \"inherit\", \"inherit\"] : [\"ignore\", \"pipe\", \"pipe\"],\n shell: false,\n });\n\n let stdout = \"\";\n let stderr = \"\";\n\n if (!options?.inherit) {\n proc.stdout?.on(\"data\", (data: Buffer) => {\n stdout += data.toString();\n });\n\n proc.stderr?.on(\"data\", (data: Buffer) => {\n stderr += data.toString();\n });\n }\n\n proc.on(\"error\", reject);\n\n proc.on(\"close\", (code) => {\n resolve({ exitCode: code ?? 1, stdout, stderr });\n });\n });\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport type { StorywrightConfig } from \"../config/types.js\";\nimport { logger } from \"../utils/logger.js\";\nimport { exec } from \"../utils/process.js\";\nimport type { Story, StoryIndex } from \"./types.js\";\n\nexport async function buildStorybook(config: StorywrightConfig, cwd: string): Promise<void> {\n if (config.storybook.url) {\n logger.info(\"Using running Storybook at\", config.storybook.url);\n return;\n }\n\n const staticDir = path.resolve(cwd, config.storybook.staticDir);\n try {\n await fs.access(path.join(staticDir, \"index.json\"));\n logger.info(\"Storybook already built at\", staticDir);\n return;\n } catch {\n // need to build\n }\n\n logger.start(\"Building Storybook...\");\n const [command, ...args] = config.storybook.buildCommand.split(\" \");\n const result = await exec(command, args, { cwd });\n if (result.exitCode !== 0) {\n throw new Error(\n `Storybook build failed (exit code ${result.exitCode}):\\n${result.stderr}\\n\\nError code: SW_E_STORYBOOK_BUILD_FAILED`,\n );\n }\n logger.success(\"Storybook built\");\n}\n\nexport async function discoverStories(config: StorywrightConfig, cwd: string): Promise<StoryIndex> {\n const staticDir = path.resolve(cwd, config.storybook.staticDir);\n const indexPath = path.join(staticDir, \"index.json\");\n\n try {\n await fs.access(indexPath);\n } catch {\n throw new Error(\n `Storybook build directory not found at '${config.storybook.staticDir}/'\\n\\n Run one of the following:\\n $ npx storybook build --stats-json\\n $ npx storywright test --storybook-url http://localhost:6006\\n\\n Error code: SW_E_STORYBOOK_DIR_NOT_FOUND`,\n );\n }\n\n const raw = JSON.parse(await fs.readFile(indexPath, \"utf-8\"));\n const indexJson = normalizeStoryIndex(raw, config.storybook.compatibility);\n\n // Version check\n if (indexJson.v < 4) {\n throw new Error(\n \"Storybook 7.x or earlier is not supported. Storywright requires Storybook 8 or later.\\n\\nError code: SW_E_STORYBOOK_UNSUPPORTED\",\n );\n }\n\n return indexJson;\n}\n\n/**\n * Parse Storybook index.json (v8+).\n */\nfunction normalizeStoryIndex(\n raw: Record<string, unknown>,\n _compatibility: \"auto\" | \"v8\",\n): StoryIndex {\n const version = typeof raw.v === \"number\" ? raw.v : 0;\n const entries = (raw.entries ?? {}) as Record<string, Story>;\n\n return { v: version, entries };\n}\n\nexport function filterStories(storyIndex: StoryIndex, config: StorywrightConfig): StoryIndex {\n const entries: Record<string, Story> = {};\n const includeMatchers = config.include.map((p) => picomatch(p));\n const excludeMatchers = config.exclude.map((p) => picomatch(p));\n\n for (const [id, story] of Object.entries(storyIndex.entries)) {\n // Skip docs entries\n if (story.type === \"docs\") continue;\n if (story.name === \"Docs\") continue;\n\n const fullName = `${story.title}/${story.name}`;\n\n // Check include patterns\n const isIncluded = includeMatchers.some((m) => m(fullName));\n if (!isIncluded) continue;\n\n // Check exclude patterns\n const isExcluded = excludeMatchers.some((m) => m(fullName));\n if (isExcluded) continue;\n\n entries[id] = story;\n }\n\n return { ...storyIndex, entries };\n}\n\nexport function excludeStoriesForBrowser(\n storyIndex: StoryIndex,\n excludePatterns: string[],\n): StoryIndex {\n if (excludePatterns.length === 0) {\n return storyIndex;\n }\n\n const excludeMatchers = excludePatterns.map((p) => picomatch(p));\n const entries: Record<string, Story> = {};\n\n for (const [id, story] of Object.entries(storyIndex.entries)) {\n const fullName = `${story.title}/${story.name}`;\n const isExcluded = excludeMatchers.some((m) => m(fullName));\n if (!isExcluded) {\n entries[id] = story;\n }\n }\n\n return { ...storyIndex, entries };\n}\n"],"mappings":";AAAA,SAAS,cAAc,oBAAoB;;;ACEpC,IAAM,iBAAoC;AAAA,EAC/C,WAAW;AAAA,IACT,WAAW;AAAA,IACX,cAAc;AAAA,IACd,KAAK;AAAA,IACL,eAAe;AAAA,EACjB;AAAA,EAEA,UAAU,CAAC,UAAU;AAAA,EACrB,gBAAgB,CAAC;AAAA,EAEjB,YAAY;AAAA,IACV,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,mBAAmB;AAAA,IACnB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EAEA,eAAe;AAAA,IACb,SAAS;AAAA,IACT,YAAY,CAAC,gBAAgB,qBAAqB,iBAAiB;AAAA,IACnE,YAAY;AAAA,IACZ,qBAAqB;AAAA,EACvB;AAAA,EAEA,SAAS;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,OAAO;AAAA,MACL,aAAa;AAAA,IACf;AAAA,IACA,IAAI;AAAA,MACF,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EAEA,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,OAAO;AAAA,EACT;AAAA,EAEA,SAAS;AAAA,EACT,SAAS;AAAA,EAET,SAAS;AAAA,IACP,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AAAA,EAEA,SAAS,CAAC,IAAI;AAAA,EACd,SAAS,CAAC;AAAA,EAEV,OAAO,CAAC;AAAA,EAER,WAAW,CAAC;AACd;;;ACzCO,IAAM,oBAAyC,oBAAI,IAA2B;AAAA,EACnF;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;AFvBM,SAAS,aACd,QACgC;AAChC,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;AAE1E,MAAI,mBAAmB,OAAO,mBAAmB,KAAK;AACpD,WAAO;AAAA,EACT;AACA,MAAI,SAAS;AACX,QAAI,QAAQ,SAAS,EAAG,QAAO;AAC/B,QAAI,QAAQ,UAAU,KAAK,mBAAmB,EAAG,QAAO;AACxD,WAAO;AAAA,EACT;AAEA,SAAO,mBAAmB,IAAI,IAAI;AACpC;AAEA,eAAe,kBAAkB,KAAa,MAA6C;AACzF,QAAM,EAAE,aAAa,IAAI,MAAM,OAAO,MAAW;AACjD,QAAM,QAAQ,MAAM,OAAO,MAAM,GAAG;AAEpC,QAAM,UAAU,KAAK,KAAK,EAAE,QAAQ,OAAO,KAAK,MAAM,CAAC;AACvD,QAAM,SAAS,aAAa,OAAO;AAEnC,QAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AAC3C,WAAO,GAAG,SAAS,MAAM;AACzB,WAAO,OAAO,MAAM,MAAM,QAAQ,CAAC;AAAA,EACrC,CAAC;AAED,SAAO,EAAE,MAAM,MAAM,OAAO,MAAM,EAAE;AACtC;","names":["fs","path","picomatch","testMatchLine","escapeBackslash","fs","path","path","path","fs","fs","path","picomatch","path","fs","picomatch","path","fs","picomatch"]}