@storywright/cli 1.1.1 → 1.2.0
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.
- package/bin/storywright.mjs +1 -1
- package/dist/{chunk-WVULPPOU.js → chunk-BDHYIXAM.js} +4 -4
- package/dist/chunk-BDHYIXAM.js.map +1 -0
- package/dist/{chunk-5XSHOSAK.js → chunk-X5LMKYHS.js} +1 -1
- package/dist/chunk-X5LMKYHS.js.map +1 -0
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/playwright/reporter.d.ts +1 -1
- package/dist/playwright/reporter.js +1 -1
- package/dist/playwright/stabilize.js.map +1 -1
- package/dist/{types-mURj8eeS.d.ts → types-sCGaLlki.d.ts} +3 -3
- package/package.json +17 -17
- package/dist/chunk-5XSHOSAK.js.map +0 -1
- package/dist/chunk-WVULPPOU.js.map +0 -1
package/bin/storywright.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import "../dist/cli.js";
|
|
@@ -223,7 +223,7 @@ var LocalStorageAdapter = class {
|
|
|
223
223
|
lsOutput = result.stdout;
|
|
224
224
|
} catch (error) {
|
|
225
225
|
throw new Error(
|
|
226
|
-
`Failed to list baselines from git branch '${branch}': ${error instanceof Error ? error.message : error}`
|
|
226
|
+
`Failed to list baselines from git branch '${branch}': ${error instanceof Error ? error.message : String(error)}`
|
|
227
227
|
);
|
|
228
228
|
}
|
|
229
229
|
const files = lsOutput.trim().split("\n").filter(Boolean);
|
|
@@ -243,7 +243,7 @@ var LocalStorageAdapter = class {
|
|
|
243
243
|
content = result.stdout;
|
|
244
244
|
} catch (error) {
|
|
245
245
|
throw new Error(
|
|
246
|
-
`Failed to extract '${file}' from git branch '${branch}': ${error instanceof Error ? error.message : error}`
|
|
246
|
+
`Failed to extract '${file}' from git branch '${branch}': ${error instanceof Error ? error.message : String(error)}`
|
|
247
247
|
);
|
|
248
248
|
}
|
|
249
249
|
const relativePath = file.slice(posixBaselineDir.length + 1);
|
|
@@ -262,7 +262,7 @@ async function createStorageAdapter(config) {
|
|
|
262
262
|
case "s3":
|
|
263
263
|
return await loadS3Adapter(config);
|
|
264
264
|
default:
|
|
265
|
-
throw new Error(`Unknown storage provider: ${config.provider}`);
|
|
265
|
+
throw new Error(`Unknown storage provider: ${String(config.provider)}`);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
async function loadS3Adapter(config) {
|
|
@@ -928,4 +928,4 @@ export {
|
|
|
928
928
|
runTests,
|
|
929
929
|
updateBaselines
|
|
930
930
|
};
|
|
931
|
-
//# sourceMappingURL=chunk-
|
|
931
|
+
//# sourceMappingURL=chunk-BDHYIXAM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config/index.ts","../src/config/defaults.ts","../src/config/types.ts","../src/reporter/cli-reporter.ts","../src/storage/local.ts","../src/storage/index.ts","../src/utils/logger.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 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","import type { Page } from \"@playwright/test\";\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}\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 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}\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","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 { 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 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({ branch: \"current\", destDir: snapshotDir, onProgress: (msg) => logger.info(msg) })\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 = { ...browserStories, entries: browserChunks[i] };\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, ${browserChunks.length} 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 });\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: { all?: boolean; upload?: boolean; shard?: string; filter?: string } = {},\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: \"current\",\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 },\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\\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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AQ,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"]}
|
|
@@ -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 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 hasDiff = imageAttachments.some((a) => a.name.includes(\"diff\"));\n\n const entry: TestEntry = {\n type: hasDiff ? \"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: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8Ad5T2SP4GYwVweJbyg84ACoEdOvFSSpcNDwEkf/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(/</g, \"\\\\u003c\")};</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,MAAM,GAAG,KAAK,KAAK,KAAK,OAAO;AACrC,UAAM,SACJ,OAAO,WAAW,WAAW,WAAW,OAAO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jF,QAAQ;AAAA;AAAA;AAGlB;AAEA,IAAO,mBAAQ;","names":["require"]}
|
package/dist/cli.js
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
logger,
|
|
7
7
|
runTests,
|
|
8
8
|
updateBaselines
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BDHYIXAM.js";
|
|
10
10
|
import {
|
|
11
11
|
generateHtmlReport
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-X5LMKYHS.js";
|
|
13
13
|
|
|
14
14
|
// src/cli/index.ts
|
|
15
15
|
import { defineCommand as defineCommand7, runMain } from "citty";
|
|
@@ -438,7 +438,7 @@ var uploadCommand = defineCommand6({
|
|
|
438
438
|
var main = defineCommand7({
|
|
439
439
|
meta: {
|
|
440
440
|
name: "storywright",
|
|
441
|
-
version: "1.
|
|
441
|
+
version: "1.2.0",
|
|
442
442
|
description: "Zero-config visual regression testing powered by Storybook + Playwright"
|
|
443
443
|
},
|
|
444
444
|
subCommands: {
|
|
@@ -450,5 +450,5 @@ var main = defineCommand7({
|
|
|
450
450
|
init: initCommand
|
|
451
451
|
}
|
|
452
452
|
});
|
|
453
|
-
runMain(main);
|
|
453
|
+
void runMain(main);
|
|
454
454
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/index.ts","../src/cli/commands/download.ts","../src/cli/commands/init.ts","../src/cli/commands/report.ts","../src/cli/commands/test.ts","../src/cli/commands/update.ts","../src/cli/commands/upload.ts"],"sourcesContent":["import { defineCommand, runMain } from 'citty';\nimport { downloadCommand } from './commands/download.js';\nimport { initCommand } from './commands/init.js';\nimport { reportCommand } from './commands/report.js';\nimport { testCommand } from './commands/test.js';\nimport { updateCommand } from './commands/update.js';\nimport { uploadCommand } from './commands/upload.js';\n\nconst main = defineCommand({\n\tmeta: {\n\t\tname: 'storywright',\n\t\tversion: __PKG_VERSION__,\n\t\tdescription: 'Zero-config visual regression testing powered by Storybook + Playwright',\n\t},\n\tsubCommands: {\n\t\ttest: testCommand,\n\t\tupdate: updateCommand,\n\t\tupload: uploadCommand,\n\t\tdownload: downloadCommand,\n\t\treport: reportCommand,\n\t\tinit: initCommand,\n\t},\n});\n\nrunMain(main);\n","import path from 'node:path';\nimport { defineCommand } from 'citty';\nimport { loadConfig } from '../../config/index.js';\nimport { createStorageAdapter } from '../../storage/index.js';\nimport { LocalStorageAdapter } from '../../storage/local.js';\nimport { logger } from '../../utils/logger.js';\n\nexport const downloadCommand = defineCommand({\n\tmeta: {\n\t\tname: 'download',\n\t\tdescription: 'Download baselines from storage',\n\t},\n\targs: {\n\t\tbranch: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Branch to download baselines from',\n\t\t\tdefault: 'main',\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst config = await loadConfig();\n\t\tconst storage = await createStorageAdapter(config.storage);\n\t\tconst destDir = path.resolve(config.storage.local.baselineDir);\n\t\tconst branch = args.branch ?? 'main';\n\n\t\tif (storage instanceof LocalStorageAdapter) {\n\t\t\tlogger.start(`Extracting baselines from git branch '${branch}'...`);\n\t\t\ttry {\n\t\t\t\tawait storage.downloadFromGit(branch, destDir, process.cwd());\n\t\t\t\tlogger.success('Baselines extracted from git');\n\t\t\t} catch (error) {\n\t\t\t\tlogger.error(String(error));\n\t\t\t\tlogger.info(\n\t\t\t\t\t'Hint: ensure you are in a git repository with sufficient history (fetch-depth: 0)',\n\t\t\t\t);\n\t\t\t\tprocess.exit(2);\n\t\t\t}\n\t\t} else {\n\t\t\tlogger.start(`Downloading baselines from ${branch}...`);\n\t\t\tawait storage.download({ branch, destDir });\n\t\t\tlogger.success('Baselines downloaded');\n\t\t}\n\t},\n});\n","import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { defineCommand } from 'citty';\nimport { logger } from '../../utils/logger.js';\n\nconst CONFIG_TEMPLATE = `import { defineConfig } from '@storywright/cli';\n\nexport default defineConfig({\n\\t// Storybook settings\n\\tstorybook: {\n\\t\\tstaticDir: 'storybook-static',\n\\t},\n\n\\t// Browsers to test\n\\tbrowsers: ['chromium'],\n\n\\t// Screenshot settings\n\\tscreenshot: {\n\\t\\tfullPage: true,\n\\t\\tanimations: 'disabled',\n\\t\\tthreshold: 0.02,\n\\t\\tmaxDiffPixelRatio: 0.02,\n\\t},\n\n\\t// Storage settings\n\\tstorage: {\n\\t\\tprovider: 'local',\n\\t},\n});\n`;\n\nexport const initCommand = defineCommand({\n\tmeta: {\n\t\tname: 'init',\n\t\tdescription: 'Initialize storywright configuration',\n\t},\n\targs: {},\n\tasync run() {\n\t\tconst configPath = path.resolve('storywright.config.ts');\n\t\ttry {\n\t\t\tawait fs.access(configPath);\n\t\t\tlogger.warn('storywright.config.ts already exists');\n\t\t\treturn;\n\t\t} catch {\n\t\t\t// file doesn't exist, create it\n\t\t}\n\n\t\tawait fs.writeFile(configPath, CONFIG_TEMPLATE);\n\t\tlogger.success('Created storywright.config.ts');\n\n\t\t// Add .storywright temp/report dirs to .gitignore if exists\n\t\t// Note: .storywright/baselines/ should be tracked by git\n\t\tconst gitignorePath = path.resolve('.gitignore');\n\t\ttry {\n\t\t\tconst content = await fs.readFile(gitignorePath, 'utf-8');\n\t\t\tif (!content.includes('.storywright')) {\n\t\t\t\tawait fs.appendFile(\n\t\t\t\t\tgitignorePath,\n\t\t\t\t\t'\\n# Storywright\\n.storywright/tmp/\\n.storywright/report/\\n',\n\t\t\t\t);\n\t\t\t\tlogger.info('Added .storywright/tmp/ and .storywright/report/ to .gitignore');\n\t\t\t}\n\t\t} catch {\n\t\t\t// no .gitignore\n\t\t}\n\t},\n});\n","import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { defineCommand } from 'citty';\nimport picomatch from 'picomatch';\nimport { loadConfig } from '../../config/index.js';\nimport type { TestSummary } from '../../core/types.js';\nimport { generateHtmlReport } from '../../playwright/reporter.js';\nimport { logger } from '../../utils/logger.js';\n\nasync function globFiles(pattern: string, cwd: string): Promise<string[]> {\n\tconst matcher = picomatch(pattern);\n\tconst results: string[] = [];\n\n\tasync function walk(dir: string): Promise<void> {\n\t\tconst entries = await fs.readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = path.join(dir, entry.name);\n\t\t\tconst relativePath = path.relative(cwd, fullPath).replace(/\\\\/g, '/');\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tawait walk(fullPath);\n\t\t\t} else if (matcher(relativePath)) {\n\t\t\t\tresults.push(fullPath);\n\t\t\t}\n\t\t}\n\t}\n\n\tawait walk(cwd);\n\treturn results;\n}\n\nexport const reportCommand = defineCommand({\n\tmeta: {\n\t\tname: 'report',\n\t\tdescription: 'Generate or open the report',\n\t},\n\targs: {\n\t\topen: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Open report in browser',\n\t\t\tdefault: false,\n\t\t},\n\t\tmerge: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Merge multiple summary files',\n\t\t\tdefault: false,\n\t\t},\n\t\tfrom: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Glob pattern for summary files to merge',\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst config = await loadConfig();\n\t\tconst reportDir = path.resolve(config.report.outputDir);\n\n\t\tif (args.merge && args.from) {\n\t\t\tlogger.start('Merging reports...');\n\t\t\tconst files = await globFiles(args.from, process.cwd());\n\n\t\t\tconst merged: TestSummary = {\n\t\t\t\ttotal: 0,\n\t\t\t\tpassed: 0,\n\t\t\t\tfailed: 0,\n\t\t\t\tskipped: 0,\n\t\t\t\tduration: 0,\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t\tbrowsers: [],\n\t\t\t\tentries: [],\n\t\t\t};\n\n\t\t\tfor (const file of files) {\n\t\t\t\tconst content = await fs.readFile(file, 'utf-8');\n\t\t\t\tconst summary: TestSummary = JSON.parse(content);\n\t\t\t\tmerged.total += summary.total;\n\t\t\t\tmerged.passed += summary.passed;\n\t\t\t\tmerged.failed += summary.failed;\n\t\t\t\tmerged.skipped += summary.skipped;\n\t\t\t\tmerged.duration = Math.max(merged.duration, summary.duration);\n\t\t\t\tmerged.browsers = [...new Set([...merged.browsers, ...summary.browsers])];\n\t\t\t\tmerged.entries.push(...summary.entries);\n\n\t\t\t\tconst shardAssetsDir = path.join(path.dirname(file), 'assets');\n\t\t\t\tconst destAssetsDir = path.join(reportDir, 'assets');\n\t\t\t\ttry {\n\t\t\t\t\tawait fs.cp(shardAssetsDir, destAssetsDir, { recursive: true });\n\t\t\t\t} catch {\n\t\t\t\t\t// assets/ が存在しないシャード (全テスト pass) はスキップ\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait fs.mkdir(reportDir, { recursive: true });\n\t\t\tawait fs.writeFile(path.join(reportDir, 'summary.json'), JSON.stringify(merged, null, 2));\n\n\t\t\tconst html = generateHtmlReport(merged);\n\t\t\tawait fs.writeFile(path.join(reportDir, 'index.html'), html);\n\t\t\tlogger.success(`Merged ${files.length} reports → index.html generated`);\n\t\t}\n\n\t\tif (args.open) {\n\t\t\tconst reportPath = path.join(reportDir, 'index.html');\n\t\t\tconst { exec: execCb } = await import('node:child_process');\n\t\t\tconst platform = process.platform;\n\t\t\tconst cmd = platform === 'darwin' ? 'open' : platform === 'win32' ? 'start' : 'xdg-open';\n\t\t\texecCb(`${cmd} ${reportPath}`);\n\t\t\tlogger.success('Report opened');\n\t\t}\n\t},\n});\n","import { defineCommand } from 'citty';\nimport { loadConfig } from '../../config/index.js';\nimport type { DeepPartial, StorywrightConfig } from '../../config/types.js';\nimport { runTests } from '../../core/engine.js';\nimport { formatSummary } from '../../reporter/cli-reporter.js';\n\nexport const testCommand = defineCommand({\n\tmeta: {\n\t\tname: 'test',\n\t\tdescription: 'Run visual regression tests',\n\t},\n\targs: {\n\t\tbrowsers: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Browsers to test (comma-separated)',\n\t\t},\n\t\tshard: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Shard specification (index/total)',\n\t\t},\n\t\t'diff-only': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Only test stories affected by git changes',\n\t\t\tdefault: false,\n\t\t},\n\t\tthreshold: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Pixel color threshold (0-1)',\n\t\t},\n\t\t'max-diff-pixel-ratio': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Maximum diff pixel ratio (0-1)',\n\t\t},\n\t\t'storybook-url': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'URL of running Storybook',\n\t\t},\n\t\t'storybook-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Storybook build directory',\n\t\t},\n\t\t'update-snapshots': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Update baseline snapshots',\n\t\t\tdefault: false,\n\t\t},\n\t\t'full-page': {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Take full page screenshots',\n\t\t},\n\t\tworkers: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Number of parallel workers',\n\t\t},\n\t\tretries: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Number of retries for failed tests',\n\t\t},\n\t\tfilter: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Filter stories by glob pattern',\n\t\t},\n\t\t'output-dir': {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Output root directory (.storywright by default)',\n\t\t},\n\t\treporters: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Reporters (comma-separated, e.g. default,html)',\n\t\t},\n\t\t'base-branch-diff-depth': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Number of commits to compare on the base branch (default: 1). Used when running on the base branch where merge-base equals HEAD.',\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst overrides: DeepPartial<StorywrightConfig> = {};\n\n\t\tif (args.browsers) {\n\t\t\toverrides.browsers = args.browsers.split(',').map((b) => b.trim());\n\t\t}\n\t\tif (args.threshold) {\n\t\t\toverrides.screenshot = { ...overrides.screenshot, threshold: Number(args.threshold) };\n\t\t}\n\t\tif (args['max-diff-pixel-ratio']) {\n\t\t\toverrides.screenshot = {\n\t\t\t\t...overrides.screenshot,\n\t\t\t\tmaxDiffPixelRatio: Number(args['max-diff-pixel-ratio']),\n\t\t\t};\n\t\t}\n\t\tif (args['storybook-url']) {\n\t\t\toverrides.storybook = { ...overrides.storybook, url: args['storybook-url'] };\n\t\t}\n\t\tif (args['storybook-dir']) {\n\t\t\toverrides.storybook = { ...overrides.storybook, staticDir: args['storybook-dir'] };\n\t\t}\n\t\tif (args['full-page'] !== undefined) {\n\t\t\toverrides.screenshot = { ...overrides.screenshot, fullPage: args['full-page'] };\n\t\t}\n\t\tif (args.workers) {\n\t\t\toverrides.workers = args.workers === 'auto' ? 'auto' : Number(args.workers);\n\t\t}\n\t\tif (args.retries) {\n\t\t\toverrides.retries = Number(args.retries);\n\t\t}\n\t\tif (args['base-branch-diff-depth']) {\n\t\t\toverrides.diffDetection = {\n\t\t\t\t...overrides.diffDetection,\n\t\t\t\tbaseBranchDiffDepth: Number(args['base-branch-diff-depth']),\n\t\t\t};\n\t\t}\n\n\t\tconst config = await loadConfig(process.cwd(), overrides);\n\t\tconst result = await runTests(\n\t\t\tconfig,\n\t\t\t{\n\t\t\t\tdiffOnly: args['diff-only'],\n\t\t\t\tshard: args.shard,\n\t\t\t\tupdateSnapshots: args['update-snapshots'],\n\t\t\t\tfilter: args.filter,\n\t\t\t\toutputDir: args['output-dir'],\n\t\t\t\treporters: args.reporters?.split(',').map((r) => r.trim()),\n\t\t\t},\n\t\t\tprocess.cwd(),\n\t\t);\n\n\t\tif (result.summary) {\n\t\t\tconst reportPath = result.reportDir ? `${result.reportDir}/index.html` : undefined;\n\t\t\tconsole.log(formatSummary(result.summary, { reportPath }));\n\t\t}\n\n\t\tprocess.exit(result.exitCode);\n\t},\n});\n","import { defineCommand } from 'citty';\nimport { loadConfig } from '../../config/index.js';\nimport type { DeepPartial, StorywrightConfig } from '../../config/types.js';\nimport { updateBaselines } from '../../core/engine.js';\n\nexport const updateCommand = defineCommand({\n\tmeta: {\n\t\tname: 'update',\n\t\tdescription: 'Update baseline snapshots',\n\t},\n\targs: {\n\t\tall: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Regenerate all baselines',\n\t\t\tdefault: false,\n\t\t},\n\t\tupload: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Upload baselines after update',\n\t\t\tdefault: false,\n\t\t},\n\t\tbrowsers: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Browsers to test (comma-separated)',\n\t\t},\n\t\tshard: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Shard specification (index/total)',\n\t\t},\n\t\tworkers: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Number of parallel workers',\n\t\t},\n\t\tfilter: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Filter stories by glob pattern',\n\t\t},\n\t\tretries: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Number of retries for failed tests',\n\t\t},\n\t\t'base-branch-diff-depth': {\n\t\t\ttype: 'string',\n\t\t\tdescription:\n\t\t\t\t'Number of commits to compare on the base branch (default: 1). Used when running on the base branch where merge-base equals HEAD.',\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst overrides: DeepPartial<StorywrightConfig> = {};\n\n\t\tif (args.browsers) {\n\t\t\toverrides.browsers = args.browsers.split(',').map((b) => b.trim());\n\t\t}\n\t\tif (args.workers) {\n\t\t\toverrides.workers = args.workers === 'auto' ? 'auto' : Number(args.workers);\n\t\t}\n\t\tif (args.retries) {\n\t\t\toverrides.retries = Number(args.retries);\n\t\t}\n\t\tif (args['base-branch-diff-depth']) {\n\t\t\toverrides.diffDetection = {\n\t\t\t\t...overrides.diffDetection,\n\t\t\t\tbaseBranchDiffDepth: Number(args['base-branch-diff-depth']),\n\t\t\t};\n\t\t}\n\n\t\tconst config = await loadConfig(process.cwd(), overrides);\n\t\tconst result = await updateBaselines(config, {\n\t\t\tall: args.all,\n\t\t\tupload: args.upload,\n\t\t\tshard: args.shard,\n\t\t\tfilter: args.filter,\n\t\t});\n\n\t\tprocess.exit(result.exitCode);\n\t},\n});\n","import path from 'node:path';\nimport { defineCommand } from 'citty';\nimport { loadConfig } from '../../config/index.js';\nimport { createStorageAdapter } from '../../storage/index.js';\nimport { logger } from '../../utils/logger.js';\n\nexport const uploadCommand = defineCommand({\n\tmeta: {\n\t\tname: 'upload',\n\t\tdescription: 'Upload baselines to remote storage',\n\t},\n\targs: {\n\t\tshard: {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'Shard identifier (e.g. \"1/3\")',\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst config = await loadConfig();\n\t\tconst storage = await createStorageAdapter(config.storage);\n\t\tconst snapshotDir = path.resolve(config.storage.local.baselineDir);\n\n\t\tlogger.start('Uploading baselines...');\n\t\tawait storage.upload({\n\t\t\tbranch: 'current',\n\t\t\tsourceDir: snapshotDir,\n\t\t\tshard: args.shard,\n\t\t});\n\t\tlogger.success('Baselines uploaded');\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,iBAAAA,gBAAe,eAAe;;;ACAvC,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAMvB,IAAM,kBAAkB,cAAc;AAAA,EAC5C,MAAM;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,EACd;AAAA,EACA,MAAM;AAAA,IACL,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACV;AAAA,EACD;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AACnB,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,UAAU,MAAM,qBAAqB,OAAO,OAAO;AACzD,UAAM,UAAU,KAAK,QAAQ,OAAO,QAAQ,MAAM,WAAW;AAC7D,UAAM,SAAS,KAAK,UAAU;AAE9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,cAAcC,MAAK,QAAQ,OAAO,QAAQ,MAAM,WAAW;AAEjE,WAAO,MAAM,wBAAwB;AACrC,UAAM,QAAQ,OAAO;AAAA,MACpB,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,OAAO,KAAK;AAAA,IACb,CAAC;AACD,WAAO,QAAQ,oBAAoB;AAAA,EACpC;AACD,CAAC;;;ANtBD,IAAM,OAAOC,eAAc;AAAA,EAC1B,MAAM;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACd;AAAA,EACA,aAAa;AAAA,IACZ,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,EACP;AACD,CAAC;AAED,QAAQ,IAAI;","names":["defineCommand","path","defineCommand","defineCommand","path","fs","path","defineCommand","fs","path","defineCommand","defineCommand","defineCommand","defineCommand","defineCommand","path","defineCommand","defineCommand","path","defineCommand"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli/index.ts","../src/cli/commands/download.ts","../src/cli/commands/init.ts","../src/cli/commands/report.ts","../src/cli/commands/test.ts","../src/cli/commands/update.ts","../src/cli/commands/upload.ts"],"sourcesContent":["import { defineCommand, runMain } from \"citty\";\nimport { downloadCommand } from \"./commands/download.js\";\nimport { initCommand } from \"./commands/init.js\";\nimport { reportCommand } from \"./commands/report.js\";\nimport { testCommand } from \"./commands/test.js\";\nimport { updateCommand } from \"./commands/update.js\";\nimport { uploadCommand } from \"./commands/upload.js\";\n\nconst main = defineCommand({\n meta: {\n name: \"storywright\",\n version: __PKG_VERSION__,\n description: \"Zero-config visual regression testing powered by Storybook + Playwright\",\n },\n subCommands: {\n test: testCommand,\n update: updateCommand,\n upload: uploadCommand,\n download: downloadCommand,\n report: reportCommand,\n init: initCommand,\n },\n});\n\nvoid runMain(main);\n","import path from \"node:path\";\nimport { defineCommand } from \"citty\";\nimport { loadConfig } from \"../../config/index.js\";\nimport { createStorageAdapter } from \"../../storage/index.js\";\nimport { LocalStorageAdapter } from \"../../storage/local.js\";\nimport { logger } from \"../../utils/logger.js\";\n\nexport const downloadCommand = defineCommand({\n meta: {\n name: \"download\",\n description: \"Download baselines from storage\",\n },\n args: {\n branch: {\n type: \"string\",\n description: \"Branch to download baselines from\",\n default: \"main\",\n },\n },\n async run({ args }) {\n const config = await loadConfig();\n const storage = await createStorageAdapter(config.storage);\n const destDir = path.resolve(config.storage.local.baselineDir);\n const branch = args.branch ?? \"main\";\n\n if (storage instanceof LocalStorageAdapter) {\n logger.start(`Extracting baselines from git branch '${branch}'...`);\n try {\n await storage.downloadFromGit(branch, destDir, process.cwd());\n logger.success(\"Baselines extracted from git\");\n } catch (error) {\n logger.error(String(error));\n logger.info(\n \"Hint: ensure you are in a git repository with sufficient history (fetch-depth: 0)\",\n );\n process.exit(2);\n }\n } else {\n logger.start(`Downloading baselines from ${branch}...`);\n await storage.download({ branch, destDir });\n logger.success(\"Baselines downloaded\");\n }\n },\n});\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { defineCommand } from \"citty\";\nimport { logger } from \"../../utils/logger.js\";\n\nconst CONFIG_TEMPLATE = `import { defineConfig } from '@storywright/cli';\n\nexport default defineConfig({\n\\t// Storybook settings\n\\tstorybook: {\n\\t\\tstaticDir: 'storybook-static',\n\\t},\n\n\\t// Browsers to test\n\\tbrowsers: ['chromium'],\n\n\\t// Screenshot settings\n\\tscreenshot: {\n\\t\\tfullPage: true,\n\\t\\tanimations: 'disabled',\n\\t\\tthreshold: 0.02,\n\\t\\tmaxDiffPixelRatio: 0.02,\n\\t},\n\n\\t// Storage settings\n\\tstorage: {\n\\t\\tprovider: 'local',\n\\t},\n});\n`;\n\nexport const initCommand = defineCommand({\n meta: {\n name: \"init\",\n description: \"Initialize storywright configuration\",\n },\n args: {},\n async run() {\n const configPath = path.resolve(\"storywright.config.ts\");\n try {\n await fs.access(configPath);\n logger.warn(\"storywright.config.ts already exists\");\n return;\n } catch {\n // file doesn't exist, create it\n }\n\n await fs.writeFile(configPath, CONFIG_TEMPLATE);\n logger.success(\"Created storywright.config.ts\");\n\n // Add .storywright temp/report dirs to .gitignore if exists\n // Note: .storywright/baselines/ should be tracked by git\n const gitignorePath = path.resolve(\".gitignore\");\n try {\n const content = await fs.readFile(gitignorePath, \"utf-8\");\n if (!content.includes(\".storywright\")) {\n await fs.appendFile(\n gitignorePath,\n \"\\n# Storywright\\n.storywright/tmp/\\n.storywright/report/\\n\",\n );\n logger.info(\"Added .storywright/tmp/ and .storywright/report/ to .gitignore\");\n }\n } catch {\n // no .gitignore\n }\n },\n});\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { defineCommand } from \"citty\";\nimport picomatch from \"picomatch\";\nimport { loadConfig } from \"../../config/index.js\";\nimport type { TestSummary } from \"../../core/types.js\";\nimport { generateHtmlReport } from \"../../playwright/reporter.js\";\nimport { logger } from \"../../utils/logger.js\";\n\nasync function globFiles(pattern: string, cwd: string): Promise<string[]> {\n const matcher = picomatch(pattern);\n const results: string[] = [];\n\n async function walk(dir: string): Promise<void> {\n const entries = await fs.readdir(dir, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n const relativePath = path.relative(cwd, fullPath).replace(/\\\\/g, \"/\");\n if (entry.isDirectory()) {\n await walk(fullPath);\n } else if (matcher(relativePath)) {\n results.push(fullPath);\n }\n }\n }\n\n await walk(cwd);\n return results;\n}\n\nexport const reportCommand = defineCommand({\n meta: {\n name: \"report\",\n description: \"Generate or open the report\",\n },\n args: {\n open: {\n type: \"boolean\",\n description: \"Open report in browser\",\n default: false,\n },\n merge: {\n type: \"boolean\",\n description: \"Merge multiple summary files\",\n default: false,\n },\n from: {\n type: \"string\",\n description: \"Glob pattern for summary files to merge\",\n },\n },\n async run({ args }) {\n const config = await loadConfig();\n const reportDir = path.resolve(config.report.outputDir);\n\n if (args.merge && args.from) {\n logger.start(\"Merging reports...\");\n const files = await globFiles(args.from, process.cwd());\n\n const merged: TestSummary = {\n total: 0,\n passed: 0,\n failed: 0,\n skipped: 0,\n duration: 0,\n timestamp: new Date().toISOString(),\n browsers: [],\n entries: [],\n };\n\n for (const file of files) {\n const content = await fs.readFile(file, \"utf-8\");\n const summary: TestSummary = JSON.parse(content);\n merged.total += summary.total;\n merged.passed += summary.passed;\n merged.failed += summary.failed;\n merged.skipped += summary.skipped;\n merged.duration = Math.max(merged.duration, summary.duration);\n merged.browsers = [...new Set([...merged.browsers, ...summary.browsers])];\n merged.entries.push(...summary.entries);\n\n const shardAssetsDir = path.join(path.dirname(file), \"assets\");\n const destAssetsDir = path.join(reportDir, \"assets\");\n try {\n await fs.cp(shardAssetsDir, destAssetsDir, { recursive: true });\n } catch {\n // assets/ が存在しないシャード (全テスト pass) はスキップ\n }\n }\n\n await fs.mkdir(reportDir, { recursive: true });\n await fs.writeFile(path.join(reportDir, \"summary.json\"), JSON.stringify(merged, null, 2));\n\n const html = generateHtmlReport(merged);\n await fs.writeFile(path.join(reportDir, \"index.html\"), html);\n logger.success(`Merged ${files.length} reports → index.html generated`);\n }\n\n if (args.open) {\n const reportPath = path.join(reportDir, \"index.html\");\n const { exec: execCb } = await import(\"node:child_process\");\n const platform = process.platform;\n const cmd = platform === \"darwin\" ? \"open\" : platform === \"win32\" ? \"start\" : \"xdg-open\";\n execCb(`${cmd} ${reportPath}`);\n logger.success(\"Report opened\");\n }\n },\n});\n","import { defineCommand } from \"citty\";\nimport { loadConfig } from \"../../config/index.js\";\nimport type { DeepPartial, StorywrightConfig } from \"../../config/types.js\";\nimport { runTests } from \"../../core/engine.js\";\nimport { formatSummary } from \"../../reporter/cli-reporter.js\";\n\nexport const testCommand = defineCommand({\n meta: {\n name: \"test\",\n description: \"Run visual regression tests\",\n },\n args: {\n browsers: {\n type: \"string\",\n description: \"Browsers to test (comma-separated)\",\n },\n shard: {\n type: \"string\",\n description: \"Shard specification (index/total)\",\n },\n \"diff-only\": {\n type: \"boolean\",\n description: \"Only test stories affected by git changes\",\n default: false,\n },\n threshold: {\n type: \"string\",\n description: \"Pixel color threshold (0-1)\",\n },\n \"max-diff-pixel-ratio\": {\n type: \"string\",\n description: \"Maximum diff pixel ratio (0-1)\",\n },\n \"storybook-url\": {\n type: \"string\",\n description: \"URL of running Storybook\",\n },\n \"storybook-dir\": {\n type: \"string\",\n description: \"Storybook build directory\",\n },\n \"update-snapshots\": {\n type: \"boolean\",\n description: \"Update baseline snapshots\",\n default: false,\n },\n \"full-page\": {\n type: \"boolean\",\n description: \"Take full page screenshots\",\n },\n workers: {\n type: \"string\",\n description: \"Number of parallel workers\",\n },\n retries: {\n type: \"string\",\n description: \"Number of retries for failed tests\",\n },\n filter: {\n type: \"string\",\n description: \"Filter stories by glob pattern\",\n },\n \"output-dir\": {\n type: \"string\",\n description: \"Output root directory (.storywright by default)\",\n },\n reporters: {\n type: \"string\",\n description: \"Reporters (comma-separated, e.g. default,html)\",\n },\n \"base-branch-diff-depth\": {\n type: \"string\",\n description:\n \"Number of commits to compare on the base branch (default: 1). Used when running on the base branch where merge-base equals HEAD.\",\n },\n },\n async run({ args }) {\n const overrides: DeepPartial<StorywrightConfig> = {};\n\n if (args.browsers) {\n overrides.browsers = args.browsers.split(\",\").map((b) => b.trim());\n }\n if (args.threshold) {\n overrides.screenshot = { ...overrides.screenshot, threshold: Number(args.threshold) };\n }\n if (args[\"max-diff-pixel-ratio\"]) {\n overrides.screenshot = {\n ...overrides.screenshot,\n maxDiffPixelRatio: Number(args[\"max-diff-pixel-ratio\"]),\n };\n }\n if (args[\"storybook-url\"]) {\n overrides.storybook = { ...overrides.storybook, url: args[\"storybook-url\"] };\n }\n if (args[\"storybook-dir\"]) {\n overrides.storybook = { ...overrides.storybook, staticDir: args[\"storybook-dir\"] };\n }\n if (args[\"full-page\"] !== undefined) {\n overrides.screenshot = { ...overrides.screenshot, fullPage: args[\"full-page\"] };\n }\n if (args.workers) {\n overrides.workers = args.workers === \"auto\" ? \"auto\" : Number(args.workers);\n }\n if (args.retries) {\n overrides.retries = Number(args.retries);\n }\n if (args[\"base-branch-diff-depth\"]) {\n overrides.diffDetection = {\n ...overrides.diffDetection,\n baseBranchDiffDepth: Number(args[\"base-branch-diff-depth\"]),\n };\n }\n\n const config = await loadConfig(process.cwd(), overrides);\n const result = await runTests(\n config,\n {\n diffOnly: args[\"diff-only\"],\n shard: args.shard,\n updateSnapshots: args[\"update-snapshots\"],\n filter: args.filter,\n outputDir: args[\"output-dir\"],\n reporters: args.reporters?.split(\",\").map((r) => r.trim()),\n },\n process.cwd(),\n );\n\n if (result.summary) {\n const reportPath = result.reportDir ? `${result.reportDir}/index.html` : undefined;\n console.log(formatSummary(result.summary, { reportPath }));\n }\n\n process.exit(result.exitCode);\n },\n});\n","import { defineCommand } from \"citty\";\nimport { loadConfig } from \"../../config/index.js\";\nimport type { DeepPartial, StorywrightConfig } from \"../../config/types.js\";\nimport { updateBaselines } from \"../../core/engine.js\";\n\nexport const updateCommand = defineCommand({\n meta: {\n name: \"update\",\n description: \"Update baseline snapshots\",\n },\n args: {\n all: {\n type: \"boolean\",\n description: \"Regenerate all baselines\",\n default: false,\n },\n upload: {\n type: \"boolean\",\n description: \"Upload baselines after update\",\n default: false,\n },\n browsers: {\n type: \"string\",\n description: \"Browsers to test (comma-separated)\",\n },\n shard: {\n type: \"string\",\n description: \"Shard specification (index/total)\",\n },\n workers: {\n type: \"string\",\n description: \"Number of parallel workers\",\n },\n filter: {\n type: \"string\",\n description: \"Filter stories by glob pattern\",\n },\n retries: {\n type: \"string\",\n description: \"Number of retries for failed tests\",\n },\n \"base-branch-diff-depth\": {\n type: \"string\",\n description:\n \"Number of commits to compare on the base branch (default: 1). Used when running on the base branch where merge-base equals HEAD.\",\n },\n },\n async run({ args }) {\n const overrides: DeepPartial<StorywrightConfig> = {};\n\n if (args.browsers) {\n overrides.browsers = args.browsers.split(\",\").map((b) => b.trim());\n }\n if (args.workers) {\n overrides.workers = args.workers === \"auto\" ? \"auto\" : Number(args.workers);\n }\n if (args.retries) {\n overrides.retries = Number(args.retries);\n }\n if (args[\"base-branch-diff-depth\"]) {\n overrides.diffDetection = {\n ...overrides.diffDetection,\n baseBranchDiffDepth: Number(args[\"base-branch-diff-depth\"]),\n };\n }\n\n const config = await loadConfig(process.cwd(), overrides);\n const result = await updateBaselines(config, {\n all: args.all,\n upload: args.upload,\n shard: args.shard,\n filter: args.filter,\n });\n\n process.exit(result.exitCode);\n },\n});\n","import path from \"node:path\";\nimport { defineCommand } from \"citty\";\nimport { loadConfig } from \"../../config/index.js\";\nimport { createStorageAdapter } from \"../../storage/index.js\";\nimport { logger } from \"../../utils/logger.js\";\n\nexport const uploadCommand = defineCommand({\n meta: {\n name: \"upload\",\n description: \"Upload baselines to remote storage\",\n },\n args: {\n shard: {\n type: \"string\",\n description: 'Shard identifier (e.g. \"1/3\")',\n },\n },\n async run({ args }) {\n const config = await loadConfig();\n const storage = await createStorageAdapter(config.storage);\n const snapshotDir = path.resolve(config.storage.local.baselineDir);\n\n logger.start(\"Uploading baselines...\");\n await storage.upload({\n branch: \"current\",\n sourceDir: snapshotDir,\n shard: args.shard,\n });\n logger.success(\"Baselines uploaded\");\n },\n});\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,iBAAAA,gBAAe,eAAe;;;ACAvC,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAMvB,IAAM,kBAAkB,cAAc;AAAA,EAC3C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,UAAU,MAAM,qBAAqB,OAAO,OAAO;AACzD,UAAM,UAAU,KAAK,QAAQ,OAAO,QAAQ,MAAM,WAAW;AAC7D,UAAM,SAAS,KAAK,UAAU;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zD,UAAM,cAAcC,MAAK,QAAQ,OAAO,QAAQ,MAAM,WAAW;AAEjE,WAAO,MAAM,wBAAwB;AACrC,UAAM,QAAQ,OAAO;AAAA,MACnB,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,OAAO,KAAK;AAAA,IACd,CAAC;AACD,WAAO,QAAQ,oBAAoB;AAAA,EACrC;AACF,CAAC;;;ANtBD,IAAM,OAAOC,eAAc;AAAA,EACzB,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EACA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AACF,CAAC;AAED,KAAK,QAAQ,IAAI;","names":["defineCommand","path","defineCommand","defineCommand","path","fs","path","defineCommand","fs","path","defineCommand","defineCommand","defineCommand","defineCommand","defineCommand","path","defineCommand","defineCommand","path","defineCommand"]}
|
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-
|
|
3
|
-
export { S as Story, b as StoryIndex, c as TestEntry } from './types-
|
|
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';
|
|
4
4
|
|
|
5
5
|
interface StorywrightConfig {
|
|
6
6
|
storybook: StorybookConfig;
|
|
@@ -10,15 +10,15 @@ interface StorywrightConfig {
|
|
|
10
10
|
diffDetection: DiffDetectionConfig;
|
|
11
11
|
storage: StorageConfig;
|
|
12
12
|
report: ReportConfig;
|
|
13
|
-
workers: number |
|
|
13
|
+
workers: number | "auto";
|
|
14
14
|
retries: number;
|
|
15
15
|
timeout: TimeoutConfig;
|
|
16
16
|
include: string[];
|
|
17
17
|
exclude: string[];
|
|
18
18
|
hooks: HooksConfig;
|
|
19
19
|
}
|
|
20
|
-
type BrowserName =
|
|
21
|
-
type PlaywrightBrowserName =
|
|
20
|
+
type BrowserName = "chromium" | "firefox" | "webkit" | (string & {});
|
|
21
|
+
type PlaywrightBrowserName = "chromium" | "firefox" | "webkit";
|
|
22
22
|
interface BrowserOption {
|
|
23
23
|
browserName?: PlaywrightBrowserName;
|
|
24
24
|
viewport?: {
|
|
@@ -35,11 +35,11 @@ interface StorybookConfig {
|
|
|
35
35
|
staticDir: string;
|
|
36
36
|
buildCommand: string;
|
|
37
37
|
url?: string;
|
|
38
|
-
compatibility:
|
|
38
|
+
compatibility: "auto" | "v8";
|
|
39
39
|
}
|
|
40
40
|
interface ScreenshotConfig {
|
|
41
41
|
fullPage: boolean;
|
|
42
|
-
animations:
|
|
42
|
+
animations: "disabled" | "allow";
|
|
43
43
|
threshold: number;
|
|
44
44
|
maxDiffPixelRatio: number;
|
|
45
45
|
freezeTime: string;
|
|
@@ -54,7 +54,7 @@ interface DiffDetectionConfig {
|
|
|
54
54
|
baseBranchDiffDepth: number;
|
|
55
55
|
}
|
|
56
56
|
interface StorageConfig {
|
|
57
|
-
provider:
|
|
57
|
+
provider: "local" | "s3";
|
|
58
58
|
local: LocalStorageConfig;
|
|
59
59
|
s3: S3StorageConfig;
|
|
60
60
|
}
|
|
@@ -65,7 +65,7 @@ interface S3StorageConfig {
|
|
|
65
65
|
bucket: string;
|
|
66
66
|
prefix: string;
|
|
67
67
|
region: string;
|
|
68
|
-
compression:
|
|
68
|
+
compression: "zstd" | "gzip" | "none";
|
|
69
69
|
}
|
|
70
70
|
interface ReportConfig {
|
|
71
71
|
outputDir: string;
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"sourcesContent":["import path from
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport { loadConfig } from \"../config/index.js\";\nimport type { DeepPartial, StorywrightConfig } from \"../config/types.js\";\nimport { formatSummary } from \"../reporter/cli-reporter.js\";\nimport { createStorageAdapter } from \"../storage/index.js\";\nimport { LocalStorageAdapter } from \"../storage/local.js\";\nimport { type TestRunResult, runTests, updateBaselines } from \"./engine.js\";\n\nexport interface Storywright {\n test(options?: {\n diffOnly?: boolean;\n browsers?: string[];\n shard?: string;\n filter?: string;\n }): Promise<TestRunResult>;\n\n update(options?: { all?: boolean }): Promise<TestRunResult>;\n upload(options?: { shard?: string }): Promise<void>;\n download(options?: { branch?: string }): Promise<void>;\n generateReport(result: TestRunResult): string | undefined;\n}\n\nexport async function createStorywright(\n userConfig?: DeepPartial<StorywrightConfig>,\n cwd: string = process.cwd(),\n): Promise<Storywright> {\n const config = await loadConfig(cwd, userConfig);\n\n return {\n async test(options = {}) {\n const overrides: DeepPartial<StorywrightConfig> = {};\n if (options.browsers) {\n overrides.browsers = options.browsers;\n }\n const mergedConfig = options.browsers\n ? await loadConfig(cwd, { ...userConfig, ...overrides })\n : config;\n\n return runTests(\n mergedConfig,\n {\n diffOnly: options.diffOnly,\n shard: options.shard,\n filter: options.filter,\n },\n cwd,\n );\n },\n\n async update(options = {}) {\n return updateBaselines(config, { all: options.all }, cwd);\n },\n\n async upload(options = {}) {\n const storage = await createStorageAdapter(config.storage);\n await storage.upload({\n branch: \"current\",\n sourceDir: path.resolve(cwd, config.storage.local.baselineDir),\n shard: options.shard,\n });\n },\n\n async download(options = {}) {\n const storage = await createStorageAdapter(config.storage);\n const destDir = path.resolve(cwd, config.storage.local.baselineDir);\n const branch = options.branch ?? \"main\";\n\n if (storage instanceof LocalStorageAdapter) {\n await storage.downloadFromGit(branch, destDir, cwd);\n } else {\n await storage.download({ branch, destDir });\n }\n },\n\n generateReport(result: TestRunResult): string | undefined {\n if (result.summary) {\n const reportPath = result.reportDir ? `${result.reportDir}/index.html` : undefined;\n return formatSummary(result.summary, { reportPath });\n }\n return undefined;\n },\n };\n}\n"],"m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A,IACF;AAAA,IAEA,eAAe,QAA2C;AACxD,UAAI,OAAO,SAAS;AAClB,cAAM,aAAa,OAAO,YAAY,GAAG,OAAO,SAAS,gBAAgB;AACzE,eAAO,cAAc,OAAO,SAAS,EAAE,WAAW,CAAC;AAAA,MACrD;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Reporter, FullConfig, Suite, TestCase, TestResult, FullResult } from '@playwright/test/reporter';
|
|
2
|
-
import { T as TestSummary } from '../types-
|
|
2
|
+
import { T as TestSummary } from '../types-sCGaLlki.js';
|
|
3
3
|
|
|
4
4
|
interface StorywrightReporterOptions {
|
|
5
5
|
outputDir?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/playwright/stabilize.ts"],"sourcesContent":["/// <reference lib=\"dom\" />\n/// <reference lib=\"dom.iterable\" />\nimport type { Page } from
|
|
1
|
+
{"version":3,"sources":["../../src/playwright/stabilize.ts"],"sourcesContent":["/// <reference lib=\"dom\" />\n/// <reference lib=\"dom.iterable\" />\nimport type { Page } from \"@playwright/test\";\n\nexport interface StabilizeOptions {\n freezeTime: string;\n seed: number;\n disableAnimations: boolean;\n}\n\n/**\n * Pre-navigation page setup for reproducible screenshots.\n * Must be called BEFORE page.goto().\n */\nexport async function initPage(page: Page, options: StabilizeOptions): Promise<void> {\n await page.clock.install({ time: new Date(options.freezeTime) });\n\n await page.addInitScript((seed: number) => {\n let s = seed;\n Math.random = () => {\n s = (s * 16807 + 0) % 2147483647;\n return (s - 1) / 2147483646;\n };\n }, options.seed);\n}\n\n/**\n * Post-navigation page stabilization for reproducible screenshots.\n * Must be called AFTER page.goto() has resolved.\n */\nexport async function stabilizePage(page: Page, options: StabilizeOptions): Promise<void> {\n if (options.disableAnimations) {\n await page.addStyleTag({\n content:\n \"*, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; transition-delay: 0s !important; }\",\n });\n }\n\n // Wait for story to render: content inside #storybook-root OR portal content on body\n await page.waitForFunction(\n () => {\n const root = document.getElementById(\"storybook-root\");\n if (!root) return false;\n if (root.childElementCount > 0) return true;\n for (const el of document.body.children) {\n if (el.tagName === \"SCRIPT\" || el.id === \"storybook-root\" || el.id === \"storybook-docs\")\n continue;\n return true;\n }\n return false;\n },\n { timeout: 10000 },\n );\n\n // Wait for web fonts to finish loading\n await page.waitForFunction(() => document.fonts.ready);\n\n // Allow async renders to settle (multiple animation frames)\n // This must run BEFORE image checks so the framework has finished adding\n // all <img> elements to the DOM\n await page.waitForFunction(\n () =>\n new Promise((resolve) => {\n let count = 0;\n const tick = () => {\n if (++count >= 3) return resolve(true);\n requestAnimationFrame(tick);\n };\n requestAnimationFrame(tick);\n }),\n );\n\n // Force lazy-loaded images to eager and wait for load\n await page.evaluate(async () => {\n const lazyImages = document.querySelectorAll('img[loading=\"lazy\"]');\n for (const img of lazyImages) {\n (img as HTMLImageElement).loading = \"eager\";\n }\n\n const images = Array.from(document.images).filter((img) => !img.complete);\n await Promise.all(\n images.map(\n (img) =>\n new Promise<void>((resolve) => {\n const timeout = setTimeout(resolve, 5000);\n img.onload = img.onerror = () => {\n clearTimeout(timeout);\n resolve();\n };\n }),\n ),\n );\n });\n\n if (options.disableAnimations) {\n await page.evaluate(() => {\n for (const img of document.querySelectorAll(\"img\")) {\n img.style.setProperty(\"opacity\", \"1\", \"important\");\n }\n });\n }\n\n // Final stabilization delay for layout shifts\n await page.waitForTimeout(200);\n}\n"],"mappings":";AAcA,eAAsB,SAAS,MAAY,SAA0C;AACnF,QAAM,KAAK,MAAM,QAAQ,EAAE,MAAM,IAAI,KAAK,QAAQ,UAAU,EAAE,CAAC;AAE/D,QAAM,KAAK,cAAc,CAAC,SAAiB;AACzC,QAAI,IAAI;AACR,SAAK,SAAS,MAAM;AAClB,WAAK,IAAI,QAAQ,KAAK;AACtB,cAAQ,IAAI,KAAK;AAAA,IACnB;AAAA,EACF,GAAG,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AAAA,EACF,CAAC;AAED,MAAI,QAAQ,mBAAmB;AAC7B,UAAM,KAAK,SAAS,MAAM;AACxB,iBAAW,OAAO,SAAS,iBAAiB,KAAK,GAAG;AAClD,YAAI,MAAM,YAAY,WAAW,KAAK,WAAW;AAAA,MACnD;AAAA,IACF,CAAC;AAAA,EACH;AAGA,QAAM,KAAK,eAAe,GAAG;AAC/B;","names":[]}
|
|
@@ -4,7 +4,7 @@ interface Story {
|
|
|
4
4
|
name: string;
|
|
5
5
|
importPath: string;
|
|
6
6
|
tags?: string[];
|
|
7
|
-
type:
|
|
7
|
+
type: "story" | "docs";
|
|
8
8
|
}
|
|
9
9
|
interface StoryIndex {
|
|
10
10
|
v: number;
|
|
@@ -13,7 +13,7 @@ interface StoryIndex {
|
|
|
13
13
|
interface TestResult {
|
|
14
14
|
story: Story;
|
|
15
15
|
browser: string;
|
|
16
|
-
status:
|
|
16
|
+
status: "passed" | "failed" | "skipped";
|
|
17
17
|
duration: number;
|
|
18
18
|
diffRatio?: number;
|
|
19
19
|
expectedPath?: string;
|
|
@@ -32,7 +32,7 @@ interface TestSummary {
|
|
|
32
32
|
entries: TestEntry[];
|
|
33
33
|
}
|
|
34
34
|
interface TestEntry {
|
|
35
|
-
type:
|
|
35
|
+
type: "diff" | "new" | "pass";
|
|
36
36
|
story: string;
|
|
37
37
|
variant: string;
|
|
38
38
|
browser: string;
|
package/package.json
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storywright/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Zero-config visual regression testing powered by Storybook + Playwright",
|
|
5
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"playwright",
|
|
7
|
+
"screenshot",
|
|
8
|
+
"storybook",
|
|
9
|
+
"testing",
|
|
10
|
+
"visual-regression-testing",
|
|
11
|
+
"vrt"
|
|
12
|
+
],
|
|
6
13
|
"license": "MIT",
|
|
7
14
|
"bin": {
|
|
8
15
|
"storywright": "./bin/storywright.mjs"
|
|
9
16
|
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"bin"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
10
22
|
"exports": {
|
|
11
23
|
".": {
|
|
12
24
|
"import": "./dist/index.js",
|
|
@@ -21,21 +33,17 @@
|
|
|
21
33
|
"types": "./dist/playwright/stabilize.d.ts"
|
|
22
34
|
}
|
|
23
35
|
},
|
|
24
|
-
"files": [
|
|
25
|
-
"dist",
|
|
26
|
-
"bin"
|
|
27
|
-
],
|
|
28
36
|
"publishConfig": {
|
|
29
37
|
"access": "public"
|
|
30
38
|
},
|
|
31
39
|
"dependencies": {
|
|
32
40
|
"citty": "^0.1.6",
|
|
33
41
|
"consola": "^3.2.3",
|
|
34
|
-
"
|
|
42
|
+
"picomatch": "^4.0.2",
|
|
35
43
|
"simple-git": "^3.27.0",
|
|
44
|
+
"sirv": "^3.0.0",
|
|
36
45
|
"unconfig": "^0.6.0",
|
|
37
|
-
"
|
|
38
|
-
"@storywright/report": "1.1.1"
|
|
46
|
+
"@storywright/report": "1.2.0"
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
41
49
|
"@playwright/test": "^1.50.0",
|
|
@@ -50,14 +58,6 @@
|
|
|
50
58
|
"engines": {
|
|
51
59
|
"node": ">=20.0.0"
|
|
52
60
|
},
|
|
53
|
-
"keywords": [
|
|
54
|
-
"storybook",
|
|
55
|
-
"playwright",
|
|
56
|
-
"visual-regression-testing",
|
|
57
|
-
"screenshot",
|
|
58
|
-
"vrt",
|
|
59
|
-
"testing"
|
|
60
|
-
],
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsup",
|
|
63
63
|
"typecheck": "tsc --noEmit",
|
|
@@ -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\tFullConfig,\n\tFullResult,\n\tTestResult as PwTestResult,\n\tReporter,\n\tSuite,\n\tTestCase,\n} from '@playwright/test/reporter';\nimport type { TestEntry, TestSummary } from '../core/types.js';\n\ninterface StorywrightReporterOptions {\n\toutputDir?: string;\n}\n\nclass StorywrightReporter implements Reporter {\n\tprivate outputDir: string;\n\tprivate results = new Map<\n\t\tstring,\n\t\t{\n\t\t\ttitle: string;\n\t\t\tproject: string;\n\t\t\tstatus: 'passed' | 'failed' | 'skipped';\n\t\t\tduration: number;\n\t\t\tattachments: { name: string; path?: string; contentType: string }[];\n\t\t}\n\t>();\n\tprivate startTime = 0;\n\n\tconstructor(options: StorywrightReporterOptions = {}) {\n\t\tthis.outputDir = options.outputDir || path.resolve('.storywright', 'report');\n\t}\n\n\tonBegin(_config: FullConfig, _suite: Suite): void {\n\t\tthis.startTime = Date.now();\n\t}\n\n\tonTestEnd(test: TestCase, result: PwTestResult): void {\n\t\tconst project = test.parent?.project()?.name ?? 'unknown';\n\t\tconst key = `${test.title}::${project}`;\n\t\tconst status =\n\t\t\tresult.status === 'passed' ? 'passed' : result.status === 'skipped' ? 'skipped' : 'failed';\n\n\t\t// Overwrite previous attempts so only the final retry result is kept\n\t\tthis.results.set(key, {\n\t\t\ttitle: test.title,\n\t\t\tproject,\n\t\t\tstatus,\n\t\t\tduration: result.duration,\n\t\t\tattachments: result.attachments.map((a) => ({\n\t\t\t\tname: a.name,\n\t\t\t\tpath: a.path,\n\t\t\t\tcontentType: a.contentType,\n\t\t\t})),\n\t\t});\n\t}\n\n\tasync onEnd(_result: FullResult): Promise<void> {\n\t\tconst duration = Date.now() - this.startTime;\n\t\tconst allResults = [...this.results.values()];\n\t\tconst passed = allResults.filter((r) => r.status === 'passed').length;\n\t\tconst failed = allResults.filter((r) => r.status === 'failed').length;\n\t\tconst skipped = allResults.filter((r) => r.status === 'skipped').length;\n\n\t\tconst browsers = [...new Set(allResults.map((r) => r.project))];\n\t\tconst entries: TestEntry[] = [];\n\n\t\t// Collect failure images\n\t\tconst assetsDir = path.join(this.outputDir, 'assets');\n\t\tfor (const dir of ['expected', 'actual', 'diff']) {\n\t\t\tfs.mkdirSync(path.join(assetsDir, dir), { recursive: true });\n\t\t}\n\n\t\tfor (const testResult of allResults) {\n\t\t\tif (testResult.status === 'skipped') continue;\n\n\t\t\tconst titleParts = testResult.title.split(': ');\n\t\t\tconst storyTitle = titleParts[0] ?? testResult.title;\n\t\t\tconst variant = titleParts.slice(1).join(': ') || 'default';\n\n\t\t\tif (testResult.status === 'passed') {\n\t\t\t\tentries.push({\n\t\t\t\t\ttype: 'pass',\n\t\t\t\t\tstory: storyTitle,\n\t\t\t\t\tvariant,\n\t\t\t\t\tbrowser: testResult.project,\n\t\t\t\t\tdiffRatio: 0,\n\t\t\t\t\texpected: '',\n\t\t\t\t\tactual: '',\n\t\t\t\t\tdiff: '',\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst sanitizedName = testResult.title.replace(/[^a-zA-Z0-9-_]/g, '-').toLowerCase();\n\n\t\t\tconst imageAttachments = testResult.attachments.filter(\n\t\t\t\t(a) => a.path && a.contentType.startsWith('image/'),\n\t\t\t);\n\t\t\tconst hasDiff = imageAttachments.some((a) => a.name.includes('diff'));\n\n\t\t\tconst entry: TestEntry = {\n\t\t\t\ttype: hasDiff ? 'diff' : 'new',\n\t\t\t\tstory: storyTitle,\n\t\t\t\tvariant,\n\t\t\t\tbrowser: testResult.project,\n\t\t\t\tdiffRatio: 0,\n\t\t\t\texpected: '',\n\t\t\t\tactual: '',\n\t\t\t\tdiff: '',\n\t\t\t};\n\n\t\t\tfor (const attachment of testResult.attachments) {\n\t\t\t\tif (!attachment.path) continue;\n\t\t\t\tconst ext = path.extname(attachment.path);\n\t\t\t\tconst destName = `${sanitizedName}-${testResult.project}${ext}`;\n\n\t\t\t\tif (attachment.name.includes('expected')) {\n\t\t\t\t\tconst dest = path.join(assetsDir, 'expected', destName);\n\t\t\t\t\tcopyFileIfExists(attachment.path, dest);\n\t\t\t\t\tentry.expected = `assets/expected/${destName}`;\n\t\t\t\t} else if (attachment.name.includes('actual')) {\n\t\t\t\t\tconst dest = path.join(assetsDir, 'actual', destName);\n\t\t\t\t\tcopyFileIfExists(attachment.path, dest);\n\t\t\t\t\tentry.actual = `assets/actual/${destName}`;\n\t\t\t\t} else if (attachment.name.includes('diff')) {\n\t\t\t\t\tconst dest = path.join(assetsDir, 'diff', destName);\n\t\t\t\t\tcopyFileIfExists(attachment.path, dest);\n\t\t\t\t\tentry.diff = `assets/diff/${destName}`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentries.push(entry);\n\t\t}\n\n\t\tconst summary: TestSummary = {\n\t\t\ttotal: allResults.length,\n\t\t\tpassed,\n\t\t\tfailed,\n\t\t\tskipped,\n\t\t\tduration,\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tbrowsers,\n\t\t\tentries,\n\t\t};\n\n\t\tfs.mkdirSync(this.outputDir, { recursive: true });\n\t\tfs.writeFileSync(path.join(this.outputDir, 'summary.json'), JSON.stringify(summary, null, 2));\n\n\t\t// Generate HTML report\n\t\tconst html = generateHtmlReport(summary);\n\t\tfs.writeFileSync(path.join(this.outputDir, 'index.html'), html);\n\t}\n}\n\nfunction copyFileIfExists(src: string, dest: string): void {\n\ttry {\n\t\tfs.copyFileSync(src, dest);\n\t} catch {\n\t\t// source may not exist\n\t}\n}\n\nexport function generateHtmlReport(summary: TestSummary): string {\n\tconst require = createRequire(import.meta.url);\n\tconst bundlePath = require.resolve('@storywright/report');\n\tconst bundleJs = fs.readFileSync(bundlePath, 'utf-8');\n\n\t// Load CSS if it exists as a separate file\n\tconst bundleDir = path.dirname(bundlePath);\n\tconst assetsDir = path.join(bundleDir, 'assets');\n\tlet cssContent = '';\n\tif (fs.existsSync(assetsDir)) {\n\t\tconst cssFiles = fs.readdirSync(assetsDir).filter((f) => f.endsWith('.css'));\n\t\tfor (const cssFile of cssFiles) {\n\t\t\tcssContent += fs.readFileSync(path.join(assetsDir, cssFile), 'utf-8');\n\t\t}\n\t}\n\n\treturn `<!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/vPEAuBm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Qlz3XwkVgBxg3lyxAsfnSq8kf5OzBJibuJeIDMp6tmIbdtje1wMXll5J/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(/</g, '\\\\u003c')};</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,EACrC;AAAA,EACA,UAAU,oBAAI,IASpB;AAAA,EACM,YAAY;AAAA,EAEpB,YAAY,UAAsC,CAAC,GAAG;AACrD,SAAK,YAAY,QAAQ,aAAa,KAAK,QAAQ,gBAAgB,QAAQ;AAAA,EAC5E;AAAA,EAEA,QAAQ,SAAqB,QAAqB;A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AAO,GAAG,OAAO;AAAA,IACrE;AAAA,EACD;AAEA,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAON,aAAa,UAAU,UAAU,aAAa,EAAE;AAAA;AAAA;AAAA;AAAA,2CAIP,KAAK,UAAU,OAAO,EAAE,QAAQ,MAAM,SAAS,CAAC;AAAA,UACjF,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/reporter/cli-reporter.ts","../src/storage/local.ts","../src/storage/index.ts","../src/utils/logger.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\tconfig: DeepPartial<StorywrightConfig>,\n): DeepPartial<StorywrightConfig> {\n\treturn config;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n\treturn value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction deepMerge(\n\ttarget: Record<string, unknown>,\n\tsource: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst result: Record<string, unknown> = { ...target };\n\tfor (const key of Object.keys(source)) {\n\t\tconst sourceVal = source[key];\n\t\tconst targetVal = result[key];\n\t\tif (isPlainObject(sourceVal) && isPlainObject(targetVal)) {\n\t\t\tresult[key] = deepMerge(targetVal, sourceVal);\n\t\t} else if (sourceVal !== undefined) {\n\t\t\tresult[key] = sourceVal;\n\t\t}\n\t}\n\treturn result;\n}\n\nexport async function loadConfig(\n\tcwd: string = process.cwd(),\n\toverrides?: DeepPartial<StorywrightConfig>,\n): Promise<StorywrightConfig> {\n\tconst { config: userConfig } = await unconfigLoad<DeepPartial<StorywrightConfig>>({\n\t\tsources: [\n\t\t\t{\n\t\t\t\tfiles: 'storywright.config',\n\t\t\t\textensions: ['ts', 'js', 'mjs'],\n\t\t\t},\n\t\t],\n\t\tcwd,\n\t});\n\n\tlet merged = DEFAULT_CONFIG as unknown as Record<string, unknown>;\n\tif (userConfig) {\n\t\tmerged = deepMerge(merged, userConfig as Record<string, unknown>);\n\t}\n\tif (overrides) {\n\t\tmerged = deepMerge(merged, overrides as Record<string, unknown>);\n\t}\n\tconst result = merged as unknown as StorywrightConfig;\n\tvalidateConfig(result);\n\treturn result;\n}\n\nfunction validateConfig(config: StorywrightConfig): void {\n\tfor (const browser of config.browsers) {\n\t\tconst options = config.browserOptions[browser];\n\n\t\tif (!STANDARD_BROWSERS.has(browser) && !options?.browserName) {\n\t\t\tthrow new Error(\n\t\t\t\t`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\t\t\t);\n\t\t}\n\n\t\tif (options?.browserName && !STANDARD_BROWSERS.has(options.browserName)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid browserName '${options.browserName}' for browser project '${browser}'.\\nValid values: 'chromium', 'firefox', 'webkit'.\\n\\nError code: SW_E_INVALID_BROWSER_NAME`,\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport type { StorywrightConfig, DeepPartial } from './types.js';\n","import type { StorywrightConfig } from './types.js';\n\nexport const DEFAULT_CONFIG: StorywrightConfig = {\n\tstorybook: {\n\t\tstaticDir: 'storybook-static',\n\t\tbuildCommand: 'npx storybook build --stats-json',\n\t\turl: undefined,\n\t\tcompatibility: 'auto',\n\t},\n\n\tbrowsers: ['chromium'],\n\tbrowserOptions: {},\n\n\tscreenshot: {\n\t\tfullPage: true,\n\t\tanimations: 'disabled',\n\t\tthreshold: 0.02,\n\t\tmaxDiffPixelRatio: 0.02,\n\t\tfreezeTime: '2024-01-01T00:00:00',\n\t\ttimezone: 'UTC',\n\t\tlocale: 'en-US',\n\t\tseed: 1,\n\t},\n\n\tdiffDetection: {\n\t\tenabled: true,\n\t\twatchFiles: ['package.json', 'package-lock.json', '.storybook/**/*'],\n\t\tbaseBranch: 'main',\n\t\tbaseBranchDiffDepth: 1,\n\t},\n\n\tstorage: {\n\t\tprovider: 'local',\n\t\tlocal: {\n\t\t\tbaselineDir: '.storywright/baselines',\n\t\t},\n\t\ts3: {\n\t\t\tbucket: '',\n\t\t\tprefix: 'storywright/baselines',\n\t\t\tregion: 'ap-northeast-1',\n\t\t\tcompression: 'zstd',\n\t\t},\n\t},\n\n\treport: {\n\t\toutputDir: '.storywright/report',\n\t\ttitle: 'Storywright Report',\n\t},\n\n\tworkers: 'auto',\n\tretries: 0,\n\n\ttimeout: {\n\t\ttest: 30000,\n\t\tnavigation: 20000,\n\t\texpect: 10000,\n\t},\n\n\tinclude: ['**'],\n\texclude: [],\n\n\thooks: {},\n};\n","import type { Page } from '@playwright/test';\n\nexport interface StorywrightConfig {\n\tstorybook: StorybookConfig;\n\tbrowsers: BrowserName[];\n\tbrowserOptions: Record<string, BrowserOption>;\n\tscreenshot: ScreenshotConfig;\n\tdiffDetection: DiffDetectionConfig;\n\tstorage: StorageConfig;\n\treport: ReportConfig;\n\tworkers: number | 'auto';\n\tretries: number;\n\ttimeout: TimeoutConfig;\n\tinclude: string[];\n\texclude: string[];\n\thooks: HooksConfig;\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\t'chromium',\n\t'firefox',\n\t'webkit',\n]);\n\nexport interface BrowserOption {\n\tbrowserName?: PlaywrightBrowserName;\n\tviewport?: { width: number; height: number };\n\tdeviceScaleFactor?: number;\n\tisMobile?: boolean;\n\thasTouch?: boolean;\n\tuserAgent?: string;\n\texclude?: string[];\n}\n\nexport interface StorybookConfig {\n\tstaticDir: string;\n\tbuildCommand: string;\n\turl?: string;\n\tcompatibility: 'auto' | 'v8';\n}\n\nexport interface ScreenshotConfig {\n\tfullPage: boolean;\n\tanimations: 'disabled' | 'allow';\n\tthreshold: number;\n\tmaxDiffPixelRatio: number;\n\tfreezeTime: string;\n\ttimezone: string;\n\tlocale: string;\n\tseed: number;\n}\n\nexport interface DiffDetectionConfig {\n\tenabled: boolean;\n\twatchFiles: string[];\n\tbaseBranch: string;\n\tbaseBranchDiffDepth: number;\n}\n\nexport interface StorageConfig {\n\tprovider: 'local' | 's3';\n\tlocal: LocalStorageConfig;\n\ts3: S3StorageConfig;\n}\n\nexport interface LocalStorageConfig {\n\tbaselineDir: string;\n}\n\nexport interface S3StorageConfig {\n\tbucket: string;\n\tprefix: string;\n\tregion: string;\n\tcompression: 'zstd' | 'gzip' | 'none';\n}\n\nexport interface ReportConfig {\n\toutputDir: string;\n\ttitle: string;\n}\n\nexport interface TimeoutConfig {\n\ttest: number;\n\tnavigation: number;\n\texpect: number;\n}\n\nexport interface StoryContext {\n\tid: string;\n\ttitle: string;\n\tname: string;\n}\n\nexport interface HooksConfig {\n\tbeforeScreenshot?: (page: Page, story: StoryContext) => Promise<void>;\n\tafterScreenshot?: (page: Page, story: StoryContext) => Promise<void>;\n}\n\nexport type DeepPartial<T> = {\n\t[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n","import type { TestSummary } from '../core/types.js';\n\nexport function formatSummary(summary: TestSummary, options?: { reportPath?: string }): string {\n\tconst durationSec = Math.round(summary.duration / 1000);\n\tconst minutes = Math.floor(durationSec / 60);\n\tconst seconds = durationSec % 60;\n\tconst durationStr = minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;\n\n\tconst lines: string[] = [\n\t\t'',\n\t\t'Storywright Results',\n\t\t'\\u2550'.repeat(42),\n\t\t` Total: ${summary.total} Passed: ${summary.passed} Failed: ${summary.failed} Skipped: ${summary.skipped}`,\n\t\t` Duration: ${durationStr}`,\n\t\t` Browsers: ${summary.browsers.join(', ')}`,\n\t];\n\n\tconst newFailures = summary.entries.filter((f) => f.type === 'new');\n\tconst diffFailures = summary.entries.filter((f) => f.type === 'diff');\n\n\tif (newFailures.length > 0) {\n\t\tlines.push('');\n\t\tlines.push(' New (no baseline):');\n\t\tfor (const failure of newFailures) {\n\t\t\tlines.push(` \\u25cb ${failure.story}: ${failure.variant} (${failure.browser})`);\n\t\t}\n\t}\n\n\tif (diffFailures.length > 0) {\n\t\tlines.push('');\n\t\tlines.push(' Failed:');\n\t\tfor (const failure of diffFailures) {\n\t\t\tlines.push(` \\u2717 ${failure.story}: ${failure.variant} (${failure.browser})`);\n\t\t\tif (failure.diffRatio > 0) {\n\t\t\t\tconst pct = (failure.diffRatio * 100).toFixed(1);\n\t\t\t\tlines.push(` \\u2192 Diff: ${pct}% pixels changed`);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst reportPath = options?.reportPath ?? '.storywright/report/index.html';\n\tlines.push('');\n\tlines.push(` Report: ${reportPath}`);\n\tlines.push('\\u2550'.repeat(42));\n\tlines.push('');\n\n\treturn 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\tconstructor(private readonly baselineDir: string) {}\n\n\tasync download(options: DownloadOptions): Promise<void> {\n\t\ttry {\n\t\t\tawait fs.access(this.baselineDir);\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t\tawait fs.cp(this.baselineDir, options.destDir, { recursive: true });\n\t}\n\n\tasync upload(options: UploadOptions): Promise<void> {\n\t\tconst resolvedSource = path.resolve(options.sourceDir);\n\t\tconst resolvedDest = path.resolve(this.baselineDir);\n\t\tif (resolvedSource === resolvedDest) {\n\t\t\treturn;\n\t\t}\n\t\tawait fs.mkdir(this.baselineDir, { recursive: true });\n\t\tawait fs.cp(options.sourceDir, this.baselineDir, { recursive: true });\n\t}\n\n\tasync exists(_branch: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait fs.access(this.baselineDir);\n\t\t\tconst entries = await fs.readdir(this.baselineDir);\n\t\t\treturn entries.length > 0;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Extract baselines from a git branch using `git ls-tree` + `git show`.\n\t * Binary-safe (PNG files) via `encoding: 'buffer'`.\n\t */\n\tasync downloadFromGit(branch: string, destDir: string, cwd: string): Promise<void> {\n\t\tconst gitPath = this.baselineDir.split(path.sep).join('/');\n\n\t\tlet lsOutput: string;\n\t\ttry {\n\t\t\tconst result = await execFileAsync(\n\t\t\t\t'git',\n\t\t\t\t['ls-tree', '-r', '--name-only', branch, '--', gitPath],\n\t\t\t\t{ cwd },\n\t\t\t);\n\t\t\tlsOutput = result.stdout;\n\t\t} catch (error) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to list baselines from git branch '${branch}': ${error instanceof Error ? error.message : error}`,\n\t\t\t);\n\t\t}\n\n\t\tconst files = lsOutput.trim().split('\\n').filter(Boolean);\n\t\tif (files.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait fs.mkdir(destDir, { recursive: true });\n\n\t\tconst posixBaselineDir = this.baselineDir.split(path.sep).join('/').replace(/\\/+$/, '');\n\n\t\tfor (const file of files) {\n\t\t\tlet content: Buffer;\n\t\t\ttry {\n\t\t\t\tconst result = await execFileAsync('git', ['show', `${branch}:${file}`], {\n\t\t\t\t\tcwd,\n\t\t\t\t\tencoding: 'buffer' as unknown as BufferEncoding,\n\t\t\t\t\tmaxBuffer: 50 * 1024 * 1024,\n\t\t\t\t});\n\t\t\t\tcontent = result.stdout as unknown as Buffer;\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to extract '${file}' from git branch '${branch}': ${error instanceof Error ? error.message : error}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst relativePath = file.slice(posixBaselineDir.length + 1);\n\t\t\tconst destPath = path.join(destDir, ...relativePath.split('/'));\n\t\t\tawait fs.mkdir(path.dirname(destPath), { recursive: true });\n\t\t\tawait fs.writeFile(destPath, content);\n\t\t}\n\t}\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\tswitch (config.provider) {\n\t\tcase 'local':\n\t\t\treturn new LocalStorageAdapter(config.local.baselineDir);\n\t\tcase 's3':\n\t\t\treturn await loadS3Adapter(config);\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown storage provider: ${config.provider}`);\n\t}\n}\n\nasync function loadS3Adapter(config: StorageConfig): Promise<StorageAdapter> {\n\ttry {\n\t\tconst { S3StorageAdapter } = await import('@storywright/storage-s3');\n\t\treturn new S3StorageAdapter(config.s3) as StorageAdapter;\n\t} catch {\n\t\tthrow new Error(\n\t\t\t'S3 storage adapter requires the @storywright/storage-s3 package.\\nInstall it with: pnpm add @storywright/storage-s3',\n\t\t);\n\t}\n}\n\nexport type { StorageAdapter, DownloadOptions, UploadOptions } from './types.js';\n","import { createConsola } from 'consola';\n\nconst isCI = !!(\n\tprocess.env.CI ||\n\tprocess.env.GITHUB_ACTIONS ||\n\tprocess.env.CIRCLECI ||\n\tprocess.env.GITLAB_CI\n);\n\nexport const logger = createConsola({\n\tlevel: process.env.STORYWRIGHT_DEBUG ? 5 : 3,\n});\n\nexport { isCI };\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\tbuildStorybook,\n\tdiscoverStories,\n\texcludeStoriesForBrowser,\n\tfilterStories,\n} from './storybook.js';\nimport type { Story, StoryIndex, TestSummary } from './types.js';\n\nexport interface TestOptions {\n\tdiffOnly?: boolean;\n\tshard?: string;\n\tupdateSnapshots?: boolean;\n\tfilter?: string;\n\toutputDir?: string;\n\treporters?: string[];\n}\n\nexport interface TestRunResult {\n\texitCode: number;\n\tsummary?: TestSummary;\n\treportDir?: string;\n\tsnapshotDir?: string;\n}\n\nconst STORIES_PER_FILE = 50;\n\nfunction resolveReporterPath(): string {\n\t// Resolve relative to this file's dist location\n\tconst thisDir = new URL('.', import.meta.url).pathname;\n\treturn path.resolve(thisDir, 'playwright', 'reporter.js');\n}\n\nfunction chunkStories(entries: Record<string, Story>): Record<string, Story>[] {\n\tconst keys = Object.keys(entries);\n\tif (keys.length === 0) return [{}];\n\tconst chunks: Record<string, Story>[] = [];\n\tfor (let i = 0; i < keys.length; i += STORIES_PER_FILE) {\n\t\tconst chunk: Record<string, Story> = {};\n\t\tfor (const key of keys.slice(i, i + STORIES_PER_FILE)) {\n\t\t\tchunk[key] = entries[key];\n\t\t}\n\t\tchunks.push(chunk);\n\t}\n\treturn chunks;\n}\n\nexport async function runTests(\n\tconfig: StorywrightConfig,\n\toptions: TestOptions = {},\n\tcwd: string = process.cwd(),\n): Promise<TestRunResult> {\n\tconst outputRoot = options.outputDir\n\t\t? path.resolve(cwd, options.outputDir)\n\t\t: resolveOutputDir(cwd, '.storywright');\n\tconst tmpDir = path.join(outputRoot, 'tmp');\n\tconst reportDir = options.outputDir\n\t\t? path.join(outputRoot, 'report')\n\t\t: path.resolve(cwd, config.report.outputDir);\n\tconst storybookDir = path.resolve(cwd, config.storybook.staticDir);\n\tconst snapshotDir = path.join(tmpDir, 'snapshots');\n\n\t// Prepare directories early for parallel operations\n\tawait fs.mkdir(snapshotDir, { recursive: true });\n\n\t// Start baseline download in parallel with Storybook build\n\t// Skip download when updating snapshots (update command) — baselines are regenerated\n\tlet baselinePromise: Promise<void> | undefined;\n\tif (!options.updateSnapshots) {\n\t\tconst storage = await createStorageAdapter(config.storage);\n\t\tbaselinePromise = storage\n\t\t\t.download({ branch: 'current', destDir: snapshotDir, onProgress: (msg) => logger.info(msg) })\n\t\t\t.catch(() => {\n\t\t\t\tlogger.info('No existing baselines found');\n\t\t\t});\n\t}\n\n\t// 1. Build Storybook if needed\n\tawait buildStorybook(config, cwd);\n\n\t// 2. Discover & filter stories\n\tlogger.start('Discovering stories...');\n\tconst allStories = await discoverStories(config, cwd);\n\tlet targetStories = filterStories(allStories, config);\n\n\t// Apply --filter option\n\tif (options.filter) {\n\t\ttargetStories = applyFilter(targetStories, options.filter);\n\t}\n\n\tlogger.info(`${Object.keys(targetStories.entries).length} stories found`);\n\n\t// 3. Diff-only: resolve affected stories (default in CI)\n\tconst effectiveDiffOnly = options.diffOnly ?? !!process.env.CI;\n\tif (effectiveDiffOnly && config.diffDetection.enabled) {\n\t\tlogger.start('Resolving dependencies...');\n\t\tconst diffResult = await resolveAffectedStories(\n\t\t\ttargetStories,\n\t\t\tconfig.diffDetection,\n\t\t\tstorybookDir,\n\t\t\tcwd,\n\t\t);\n\t\tif (!diffResult.allStories) {\n\t\t\ttargetStories = diffResult.targetStories;\n\t\t}\n\t\tlogger.info(`${Object.keys(targetStories.entries).length} stories affected by changes`);\n\t}\n\n\t// 4. Wait for baseline download to complete\n\tawait baselinePromise;\n\n\t// 5. Generate split test files for better worker distribution\n\tlet testFilePattern: string;\n\tlet testMatchByBrowser: Record<string, string> | undefined;\n\n\tconst browserExcludesExist = config.browsers.some(\n\t\t(b) => (config.browserOptions[b]?.exclude ?? []).length > 0,\n\t);\n\n\tif (browserExcludesExist) {\n\t\t// Generate per-browser test files when any browser has specific excludes\n\t\ttestMatchByBrowser = {};\n\n\t\tfor (const browser of config.browsers) {\n\t\t\tconst browserExclude = config.browserOptions[browser]?.exclude ?? [];\n\t\t\tconst browserStories = excludeStoriesForBrowser(targetStories, browserExclude);\n\n\t\t\tif (Object.keys(browserStories.entries).length === 0) {\n\t\t\t\tlogger.warn(\n\t\t\t\t\t`${browser}: All stories excluded by browser-specific 'exclude' patterns. No tests will run for this browser.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst browserChunks = chunkStories(browserStories.entries);\n\n\t\t\ttestMatchByBrowser[browser] =\n\t\t\t\tbrowserChunks.length === 1\n\t\t\t\t\t? `storywright-${browser}-0.spec.ts`\n\t\t\t\t\t: `storywright-${browser}-*.spec.ts`;\n\n\t\t\tfor (let i = 0; i < browserChunks.length; i++) {\n\t\t\t\tconst chunkIndex: StoryIndex = { ...browserStories, entries: browserChunks[i] };\n\t\t\t\tconst chunkPath = path.join(tmpDir, `target-stories-${browser}-${i}.json`);\n\t\t\t\tawait fs.writeFile(chunkPath, JSON.stringify(chunkIndex));\n\n\t\t\t\tconst testContent = generateTestFile(config.screenshot, {\n\t\t\t\t\ttargetStoriesPath: chunkPath.replace(/\\\\/g, '/'),\n\t\t\t\t});\n\t\t\t\tawait fs.writeFile(path.join(tmpDir, `storywright-${browser}-${i}.spec.ts`), testContent);\n\t\t\t}\n\n\t\t\tlogger.info(\n\t\t\t\t`${browser}: ${Object.keys(browserStories.entries).length} stories, ${browserChunks.length} test file(s)`,\n\t\t\t);\n\t\t}\n\n\t\ttestFilePattern = 'storywright-*.spec.ts';\n\t} else {\n\t\t// Default: shared test files for all browsers\n\t\tconst chunks = chunkStories(targetStories.entries);\n\t\ttestFilePattern = chunks.length === 1 ? 'storywright-0.spec.ts' : 'storywright-*.spec.ts';\n\n\t\tfor (let i = 0; i < chunks.length; i++) {\n\t\t\tconst chunkIndex: StoryIndex = { ...targetStories, entries: chunks[i] };\n\t\t\tconst chunkPath = path.join(tmpDir, `target-stories-${i}.json`);\n\t\t\tawait fs.writeFile(chunkPath, JSON.stringify(chunkIndex));\n\n\t\t\tconst testContent = generateTestFile(config.screenshot, {\n\t\t\t\ttargetStoriesPath: chunkPath.replace(/\\\\/g, '/'),\n\t\t\t});\n\t\t\tawait fs.writeFile(path.join(tmpDir, `storywright-${i}.spec.ts`), testContent);\n\t\t}\n\n\t\tlogger.info(`${chunks.length} test file(s) generated`);\n\t}\n\n\t// 6. Generate Playwright config\n\tconst reporterWrapperPath = path.join(tmpDir, 'reporter.mjs');\n\tconst resolvedReporterPath = resolveReporterPath().replace(/\\\\/g, '/');\n\tconst reporterOutputDir = reportDir.replace(/\\\\/g, '/');\n\n\tawait fs.writeFile(\n\t\treporterWrapperPath,\n\t\t`import StorywrightReporter from '${resolvedReporterPath}';\\nexport default class extends StorywrightReporter {\\n constructor() { super({ outputDir: '${reporterOutputDir}' }); }\\n}\\n`,\n\t);\n\n\t// Determine Storybook URL\n\tlet actualStorybookUrl = config.storybook.url;\n\tconst needsServer = !actualStorybookUrl;\n\n\tif (needsServer) {\n\t\tactualStorybookUrl = 'http://localhost:6007';\n\t}\n\n\tconst playwrightConfig = generatePlaywrightConfig(config, {\n\t\ttmpDir: tmpDir.replace(/\\\\/g, '/'),\n\t\tstorybookUrl: actualStorybookUrl ?? 'http://localhost:6007',\n\t\tsnapshotDir: snapshotDir.replace(/\\\\/g, '/'),\n\t\treporterPath: reporterWrapperPath.replace(/\\\\/g, '/'),\n\t\ttestMatch: testFilePattern,\n\t\ttestMatchByBrowser,\n\t\tshard: options.shard,\n\t\treporters: options.reporters,\n\t});\n\n\tconst configPath = path.join(tmpDir, 'playwright.config.ts');\n\tawait fs.writeFile(configPath, playwrightConfig);\n\n\t// 7. Run Playwright tests\n\tlogger.start('Running tests...');\n\tconst args = ['playwright', 'test', '--config', configPath];\n\n\tif (options.updateSnapshots) {\n\t\targs.push('--update-snapshots');\n\t}\n\n\t// Start static server if needed\n\tlet serverProc: { kill: () => void } | undefined;\n\tif (needsServer) {\n\t\tserverProc = await startStaticServer(storybookDir, 6007);\n\t}\n\n\ttry {\n\t\tconst result = await exec('npx', args, { cwd, inherit: true });\n\n\t\t// 8. Read results\n\t\tlet summary: TestSummary | undefined;\n\t\ttry {\n\t\t\tconst summaryPath = path.join(reportDir, 'summary.json');\n\t\t\tconst summaryContent = await fs.readFile(summaryPath, 'utf-8');\n\t\t\tsummary = JSON.parse(summaryContent);\n\t\t} catch {\n\t\t\t// summary may not exist if no tests ran\n\t\t}\n\n\t\t// 9. Map exit codes per SPEC §14.2\n\t\tconst exitCode = mapExitCode(result.exitCode, summary);\n\n\t\treturn { exitCode, summary, reportDir, snapshotDir };\n\t} finally {\n\t\tserverProc?.kill();\n\t}\n}\n\nexport async function updateBaselines(\n\tconfig: StorywrightConfig,\n\toptions: { all?: boolean; upload?: boolean; shard?: string; filter?: string } = {},\n\tcwd: string = process.cwd(),\n): Promise<TestRunResult> {\n\tconst result = await runTests(\n\t\tconfig,\n\t\t{\n\t\t\tupdateSnapshots: true,\n\t\t\tdiffOnly: !options.all,\n\t\t\tshard: options.shard,\n\t\t\tfilter: options.filter,\n\t\t},\n\t\tcwd,\n\t);\n\n\tif (result.exitCode !== 0) {\n\t\tlogger.warn('Some tests failed during baseline update');\n\t}\n\n\t// Save updated snapshots back to baselineDir (local disk operation)\n\tif (result.snapshotDir) {\n\t\tconst baselineDir = path.resolve(cwd, config.storage.local.baselineDir);\n\t\tawait fs.mkdir(baselineDir, { recursive: true });\n\t\tawait fs.cp(result.snapshotDir, baselineDir, { recursive: true });\n\t\tlogger.success(`Baselines saved to ${config.storage.local.baselineDir}`);\n\t}\n\n\t// --upload: upload to remote storage (S3 etc.) only when explicitly requested\n\tif (options.upload) {\n\t\tconst storage = await createStorageAdapter(config.storage);\n\t\tconst baselineDir = path.resolve(cwd, config.storage.local.baselineDir);\n\t\tawait storage.upload({\n\t\t\tbranch: 'current',\n\t\t\tsourceDir: baselineDir,\n\t\t\tshard: options.shard,\n\t\t\tonProgress: (msg) => logger.info(msg),\n\t\t});\n\t\tlogger.success('Baselines uploaded to remote storage');\n\t}\n\n\treturn result;\n}\n\nfunction applyFilter(storyIndex: StoryIndex, filter: string): StoryIndex {\n\tconst matcher = picomatch(filter);\n\tconst entries: Record<string, StoryIndex['entries'][string]> = {};\n\tfor (const [id, story] of Object.entries(storyIndex.entries)) {\n\t\tconst fullName = `${story.title}/${story.name}`;\n\t\tif (matcher(fullName) || matcher(story.title) || matcher(story.id)) {\n\t\t\tentries[id] = story;\n\t\t}\n\t}\n\treturn { ...storyIndex, entries };\n}\n\nfunction mapExitCode(playwrightCode: number, summary?: TestSummary): number {\n\t// SPEC §14.2: 0 = success (no diff), 1 = success (diff found), 2 = execution error, 130 = SIGINT\n\tif (playwrightCode === 130 || playwrightCode === 143) {\n\t\treturn 130; // SIGINT / SIGTERM\n\t}\n\tif (summary) {\n\t\tif (summary.failed > 0) return 1;\n\t\tif (summary.total === 0 && playwrightCode !== 0) return 2;\n\t\treturn 0;\n\t}\n\t// No summary = likely execution error\n\treturn playwrightCode === 0 ? 0 : 2;\n}\n\nasync function startStaticServer(dir: string, port: number): Promise<{ kill: () => void }> {\n\tconst { createServer } = await import('node:http');\n\tconst sirv = (await import('sirv')).default;\n\n\tconst handler = sirv(dir, { single: false, dev: false });\n\tconst server = createServer(handler);\n\n\tawait new Promise<void>((resolve, reject) => {\n\t\tserver.on('error', reject);\n\t\tserver.listen(port, () => resolve());\n\t});\n\n\treturn { 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\tconfig: StorywrightConfig,\n\toptions: {\n\t\ttmpDir: string;\n\t\tstorybookUrl: string;\n\t\tsnapshotDir: string;\n\t\treporterPath: string;\n\t\ttestMatch: string;\n\t\ttestMatchByBrowser?: Record<string, string>;\n\t\tshard?: string;\n\t\treporters?: string[];\n\t},\n): string {\n\tconst projects = config.browsers.map((browser) => {\n\t\tconst rawOptions = config.browserOptions[browser];\n\t\tconst useObj = buildBrowserUseObject(browser, rawOptions);\n\t\tconst useStr = JSON.stringify(useObj, null, '\\t\\t');\n\t\tconst testMatch = options.testMatchByBrowser?.[browser];\n\t\tconst testMatchLine = testMatch ? `\\n\\t\\t\\ttestMatch: '${escapeBackslash(testMatch)}',` : '';\n\t\treturn `\\t\\t{\n\\t\\t\\tname: '${browser}',${testMatchLine}\n\\t\\t\\tuse: ${useStr},\n\\t\\t}`;\n\t});\n\n\tconst workers = config.workers === 'auto' ? \"'100%'\" : String(config.workers);\n\n\tconst shard = options.shard\n\t\t? `\\tshard: { current: ${options.shard.split('/')[0]}, total: ${options.shard.split('/')[1]} },`\n\t\t: '';\n\n\t// Build reporter list: always include custom reporter, plus user-requested ones\n\tconst reporterEntries: string[] = [];\n\tconst requestedReporters = options.reporters ?? ['default', 'html'];\n\tfor (const r of requestedReporters) {\n\t\tif (r === 'default' || r === 'list') {\n\t\t\treporterEntries.push(\"\\t\\t['list']\");\n\t\t} else if (r !== 'html') {\n\t\t\t// Pass through other built-in Playwright reporters (dot, json, junit, etc.)\n\t\t\treporterEntries.push(`\\t\\t['${r}']`);\n\t\t}\n\t}\n\t// Always include custom storywright reporter\n\treporterEntries.push(`\\t\\t['${escapeBackslash(options.reporterPath)}']`);\n\n\tconst testMatchLine = options.testMatchByBrowser\n\t\t? ''\n\t\t: `\\ttestMatch: '${escapeBackslash(options.testMatch)}',\\n`;\n\n\treturn `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\\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\tbrowser: string,\n\trawOptions?: BrowserOption,\n): Record<string, unknown> {\n\tlet browserName: string;\n\tif (rawOptions?.browserName) {\n\t\tbrowserName = rawOptions.browserName;\n\t} else if (STANDARD_BROWSERS.has(browser)) {\n\t\tbrowserName = browser;\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Cannot resolve browserName for custom browser project '${browser}'.\\n\\nError code: SW_E_INTERNAL_BROWSER_RESOLVE`,\n\t\t);\n\t}\n\tconst useObj: Record<string, unknown> = { browserName };\n\n\tif (rawOptions) {\n\t\tconst { browserName: _, exclude: __, ...rest } = rawOptions;\n\t\tObject.assign(useObj, rest);\n\t}\n\n\treturn useObj;\n}\n\nfunction escapeBackslash(str: string): string {\n\treturn str.replace(/\\\\/g, '/');\n}\n","import type { ScreenshotConfig } from '../config/types.js';\n\nexport function generateTestFile(\n\tconfig: ScreenshotConfig,\n\toptions: {\n\t\ttargetStoriesPath: string;\n\t},\n): string {\n\tconst disableAnimations = config.animations === 'disabled';\n\n\treturn `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\treturn 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\tgetDependencies(filePath: string): string[];\n\tgetStoriesForFiles(pathList: string[]): StoryIndex;\n}\n\nconst STORY_FILE_PATTERNS = ['.stories.', '.mdx'];\n\nfunction isStoryFile(moduleName: string): boolean {\n\treturn STORY_FILE_PATTERNS.some((p) => moduleName.includes(p));\n}\n\nexport class StorybookStatsDependencyResolver implements DependencyResolver {\n\tprivate moduleMap: Record<string, StatsModule>;\n\n\tconstructor(\n\t\tprivate statsJson: StatsIndex,\n\t\tprivate storiesJson: StoryIndex,\n\t) {\n\t\tthis.moduleMap = {};\n\t\tfor (const mod of statsJson.modules) {\n\t\t\t// Key by normalized name (primary) and normalized id (fallback)\n\t\t\tconst normalizedName = normalizePath(mod.name);\n\t\t\tthis.moduleMap[normalizedName] = mod;\n\t\t\tconst normalizedId = normalizePath(mod.id);\n\t\t\tif (normalizedId !== normalizedName) {\n\t\t\t\tthis.moduleMap[normalizedId] ??= mod;\n\t\t\t}\n\t\t}\n\t}\n\n\tgetDependencies(filePath: string): string[] {\n\t\tconst normalizedPath = normalizePath(filePath);\n\t\tconst dependencies = this.collectDependencies(normalizedPath);\n\n\t\tif (this.moduleMap[normalizedPath]) {\n\t\t\tdependencies.add(normalizedPath);\n\t\t}\n\n\t\treturn [...dependencies];\n\t}\n\n\tgetStoriesForFiles(pathList: string[]): StoryIndex {\n\t\tconst result: StoryIndex = { v: this.storiesJson.v, entries: {} };\n\n\t\tfor (const filePath of pathList) {\n\t\t\t// Finding #2 + #3: lookup via normalized moduleMap (name primary, id fallback)\n\t\t\tconst normalizedPath = normalizePath(filePath);\n\t\t\tconst stats = this.moduleMap[normalizedPath];\n\t\t\tif (!stats) continue;\n\n\t\t\t// Finding #1: collect ALL story reasons, not just first\n\t\t\tconst storyReasons = stats.reasons.filter((r) => isStoryFile(r.moduleName));\n\t\t\tfor (const reason of storyReasons) {\n\t\t\t\tconst normalizedImportPath = normalizePath(reason.moduleName);\n\t\t\t\t// Collect ALL matching story entries per reason\n\t\t\t\tfor (const storyObj of Object.values(this.storiesJson.entries)) {\n\t\t\t\t\tif (storyObj.type !== 'story') continue;\n\t\t\t\t\tif (normalizePath(storyObj.importPath) === normalizedImportPath) {\n\t\t\t\t\t\tresult.entries[storyObj.id] = storyObj;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate collectDependencies(name: string, result = new Set<string>()): Set<string> {\n\t\tconst mod = this.moduleMap[normalizePath(name)];\n\t\tif (mod) {\n\t\t\tfor (const reason of mod.reasons) {\n\t\t\t\tif (!result.has(reason.moduleName)) {\n\t\t\t\t\tresult.add(reason.moduleName);\n\t\t\t\t\tthis.collectDependencies(reason.moduleName, result);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n}\n\nexport interface DiffResult {\n\tallStories: boolean;\n\ttargetStories: StoryIndex;\n}\n\ninterface DiffFileEntry {\n\tfile: string;\n\tfrom?: string;\n}\n\nexport async function resolveAffectedStories(\n\tstoriesJson: StoryIndex,\n\tconfig: DiffDetectionConfig,\n\tstorybookStaticDir: string,\n\tcwd: string,\n): Promise<DiffResult> {\n\tconst git = simpleGit({ baseDir: cwd });\n\n\t// Get diff summary\n\tlet diffEntries: DiffFileEntry[];\n\ttry {\n\t\t// Detect if HEAD is on the base branch (e.g. main)\n\t\tconst currentBranch = (await git.raw(['rev-parse', '--abbrev-ref', 'HEAD'])).trim();\n\t\tconst isOnBaseBranch = currentBranch === config.baseBranch;\n\n\t\tlet diffBase: string;\n\t\tif (isOnBaseBranch && config.baseBranchDiffDepth > 0) {\n\t\t\t// On the base branch, merge-base == HEAD so diff would be empty.\n\t\t\t// Use HEAD~N to compare against the previous commit(s) instead.\n\t\t\tdiffBase = `HEAD~${config.baseBranchDiffDepth}`;\n\t\t\tlogger.info(`On base branch '${config.baseBranch}', using ${diffBase} for diff detection`);\n\t\t} else {\n\t\t\tconst mergeBase = await git.raw(['merge-base', config.baseBranch, 'HEAD']);\n\t\t\tdiffBase = mergeBase.trim();\n\t\t}\n\n\t\tconst diff = await git.diffSummary([diffBase, 'HEAD']);\n\t\tdiffEntries = diff.files.map((f) => ({\n\t\t\tfile: f.file,\n\t\t\t// Handle renames: include both old and new paths\n\t\t\tfrom: 'from' in f ? (f as { from: string }).from : undefined,\n\t\t}));\n\t} catch {\n\t\tlogger.warn('Failed to resolve git diff, running all stories');\n\t\treturn { allStories: true, targetStories: storiesJson };\n\t}\n\n\tif (diffEntries.length === 0) {\n\t\tlogger.info('No changed files detected');\n\t\treturn { allStories: false, targetStories: { v: storiesJson.v, entries: {} } };\n\t}\n\n\t// Collect all affected paths (including rename sources)\n\tconst allPaths: string[] = [];\n\tfor (const entry of diffEntries) {\n\t\tallPaths.push(entry.file);\n\t\tif (entry.from) {\n\t\t\tallPaths.push(entry.from);\n\t\t}\n\t}\n\n\t// Check watchFiles\n\tfor (const file of allPaths) {\n\t\tfor (const pattern of config.watchFiles) {\n\t\t\tif (picomatch(pattern)(file)) {\n\t\t\t\tlogger.info(`Watch file changed: ${file}, running all stories`);\n\t\t\t\treturn { allStories: true, targetStories: storiesJson };\n\t\t\t}\n\t\t}\n\t}\n\n\t// Load stats json for dependency resolution\n\tconst statsPath = path.resolve(storybookStaticDir, 'preview-stats.json');\n\tlet statsJson: StatsIndex;\n\ttry {\n\t\tstatsJson = JSON.parse(await fs.readFile(statsPath, 'utf-8'));\n\t} catch {\n\t\tlogger.warn('preview-stats.json not found, running all stories');\n\t\treturn { allStories: true, targetStories: storiesJson };\n\t}\n\n\tconst resolver = new StorybookStatsDependencyResolver(statsJson, storiesJson);\n\tconst targetStories: StoryIndex = { v: storiesJson.v, entries: {} };\n\n\t// Direct story file matches (both .stories.* and .mdx)\n\tfor (const file of allPaths) {\n\t\tconst matchedStories = Object.values(storiesJson.entries).filter(\n\t\t\t(story) => stripLeadingDotSlash(story.importPath) === file,\n\t\t);\n\t\tfor (const story of matchedStories) {\n\t\t\ttargetStories.entries[story.id] = story;\n\t\t}\n\t}\n\n\t// Dependency-based matches\n\tfor (const file of allPaths) {\n\t\tconst deps = resolver.getDependencies(normalizePath(file));\n\t\tconst depStories = resolver.getStoriesForFiles(deps);\n\t\tfor (const [id, story] of Object.entries(depStories.entries)) {\n\t\t\ttargetStories.entries[id] = story;\n\t\t}\n\t}\n\n\tlogger.info(`Resolved ${Object.keys(targetStories.entries).length} affected stories`);\n\treturn { allStories: false, targetStories };\n}\n","import path from 'node:path';\n\nexport function normalizePath(filePath: string): string {\n\tconst normalized = filePath.replace(/\\\\/g, '/');\n\tif (normalized.startsWith('./')) {\n\t\treturn normalized;\n\t}\n\treturn `./${normalized}`;\n}\n\nexport function stripLeadingDotSlash(filePath: string): string {\n\treturn filePath.replace(/^\\.\\//, '');\n}\n\nexport function resolveOutputDir(outputDir: string, ...segments: string[]): string {\n\treturn path.resolve(outputDir, ...segments);\n}\n","import { spawn } from 'node:child_process';\n\nexport interface ExecResult {\n\texitCode: number;\n\tstdout: string;\n\tstderr: string;\n}\n\nexport function exec(\n\tcommand: string,\n\targs: string[],\n\toptions?: { cwd?: string; env?: Record<string, string>; inherit?: boolean },\n): Promise<ExecResult> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst proc = spawn(command, args, {\n\t\t\tcwd: options?.cwd,\n\t\t\tenv: { ...process.env, ...options?.env },\n\t\t\tstdio: options?.inherit ? ['ignore', 'inherit', 'inherit'] : ['ignore', 'pipe', 'pipe'],\n\t\t\tshell: false,\n\t\t});\n\n\t\tlet stdout = '';\n\t\tlet stderr = '';\n\n\t\tif (!options?.inherit) {\n\t\t\tproc.stdout?.on('data', (data: Buffer) => {\n\t\t\t\tstdout += data.toString();\n\t\t\t});\n\n\t\t\tproc.stderr?.on('data', (data: Buffer) => {\n\t\t\t\tstderr += data.toString();\n\t\t\t});\n\t\t}\n\n\t\tproc.on('error', reject);\n\n\t\tproc.on('close', (code) => {\n\t\t\tresolve({ exitCode: code ?? 1, stdout, stderr });\n\t\t});\n\t});\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\tif (config.storybook.url) {\n\t\tlogger.info('Using running Storybook at', config.storybook.url);\n\t\treturn;\n\t}\n\n\tconst staticDir = path.resolve(cwd, config.storybook.staticDir);\n\ttry {\n\t\tawait fs.access(path.join(staticDir, 'index.json'));\n\t\tlogger.info('Storybook already built at', staticDir);\n\t\treturn;\n\t} catch {\n\t\t// need to build\n\t}\n\n\tlogger.start('Building Storybook...');\n\tconst [command, ...args] = config.storybook.buildCommand.split(' ');\n\tconst result = await exec(command, args, { cwd });\n\tif (result.exitCode !== 0) {\n\t\tthrow new Error(\n\t\t\t`Storybook build failed (exit code ${result.exitCode}):\\n${result.stderr}\\n\\nError code: SW_E_STORYBOOK_BUILD_FAILED`,\n\t\t);\n\t}\n\tlogger.success('Storybook built');\n}\n\nexport async function discoverStories(config: StorywrightConfig, cwd: string): Promise<StoryIndex> {\n\tconst staticDir = path.resolve(cwd, config.storybook.staticDir);\n\tconst indexPath = path.join(staticDir, 'index.json');\n\n\ttry {\n\t\tawait fs.access(indexPath);\n\t} catch {\n\t\tthrow new Error(\n\t\t\t`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\t\t);\n\t}\n\n\tconst raw = JSON.parse(await fs.readFile(indexPath, 'utf-8'));\n\tconst indexJson = normalizeStoryIndex(raw, config.storybook.compatibility);\n\n\t// Version check\n\tif (indexJson.v < 4) {\n\t\tthrow new Error(\n\t\t\t'Storybook 7.x or earlier is not supported. Storywright requires Storybook 8 or later.\\n\\nError code: SW_E_STORYBOOK_UNSUPPORTED',\n\t\t);\n\t}\n\n\treturn indexJson;\n}\n\n/**\n * Parse Storybook index.json (v8+).\n */\nfunction normalizeStoryIndex(\n\traw: Record<string, unknown>,\n\t_compatibility: 'auto' | 'v8',\n): StoryIndex {\n\tconst version = typeof raw.v === 'number' ? raw.v : 0;\n\tconst entries = (raw.entries ?? {}) as Record<string, Story>;\n\n\treturn { v: version, entries };\n}\n\nexport function filterStories(storyIndex: StoryIndex, config: StorywrightConfig): StoryIndex {\n\tconst entries: Record<string, Story> = {};\n\tconst includeMatchers = config.include.map((p) => picomatch(p));\n\tconst excludeMatchers = config.exclude.map((p) => picomatch(p));\n\n\tfor (const [id, story] of Object.entries(storyIndex.entries)) {\n\t\t// Skip docs entries\n\t\tif (story.type === 'docs') continue;\n\t\tif (story.name === 'Docs') continue;\n\n\t\tconst fullName = `${story.title}/${story.name}`;\n\n\t\t// Check include patterns\n\t\tconst isIncluded = includeMatchers.some((m) => m(fullName));\n\t\tif (!isIncluded) continue;\n\n\t\t// Check exclude patterns\n\t\tconst isExcluded = excludeMatchers.some((m) => m(fullName));\n\t\tif (isExcluded) continue;\n\n\t\tentries[id] = story;\n\t}\n\n\treturn { ...storyIndex, entries };\n}\n\nexport function excludeStoriesForBrowser(\n\tstoryIndex: StoryIndex,\n\texcludePatterns: string[],\n): StoryIndex {\n\tif (excludePatterns.length === 0) {\n\t\treturn storyIndex;\n\t}\n\n\tconst excludeMatchers = excludePatterns.map((p) => picomatch(p));\n\tconst entries: Record<string, Story> = {};\n\n\tfor (const [id, story] of Object.entries(storyIndex.entries)) {\n\t\tconst fullName = `${story.title}/${story.name}`;\n\t\tconst isExcluded = excludeMatchers.some((m) => m(fullName));\n\t\tif (!isExcluded) {\n\t\t\tentries[id] = story;\n\t\t}\n\t}\n\n\treturn { ...storyIndex, entries };\n}\n"],"mappings":";AAAA,SAAS,cAAc,oBAAoB;;;ACEpC,IAAM,iBAAoC;AAAA,EAChD,WAAW;AAAA,IACV,WAAW;AAAA,IACX,cAAc;AAAA,IACd,KAAK;AAAA,IACL,eAAe;AAAA,EAChB;AAAA,EAEA,UAAU,CAAC,UAAU;AAAA,EACrB,gBAAgB,CAAC;AAAA,EAEjB,YAAY;AAAA,IACX,UAAU;AAAA,IACV,YAAY;AAAA,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,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;AAC5C,WAAO,GAAG,SAAS,MAAM;AACzB,WAAO,OAAO,MAAM,MAAM,QAAQ,CAAC;AAAA,EACpC,CAAC;AAED,SAAO,EAAE,MAAM,MAAM,OAAO,MAAM,EAAE;AACrC;","names":["fs","path","picomatch","testMatchLine","escapeBackslash","fs","path","path","path","fs","fs","path","picomatch","path","fs","picomatch","path","fs","picomatch"]}
|