tryscript 0.1.2 → 0.1.4
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/README.md +39 -50
- package/dist/bin.cjs +382 -13
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.mjs +384 -15
- package/dist/bin.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.mts +8 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-BR3CZ3tc.cjs → src-BGWMAShO.cjs} +4 -3
- package/dist/src-BGWMAShO.cjs.map +1 -0
- package/dist/{src-DKrim0QL.mjs → src-D60Uy8QA.mjs} +4 -3
- package/dist/src-D60Uy8QA.mjs.map +1 -0
- package/docs/tryscript-reference.md +84 -22
- package/package.json +4 -2
- package/dist/src-BR3CZ3tc.cjs.map +0 -1
- package/dist/src-DKrim0QL.mjs.map +0 -1
package/dist/bin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.mjs","names":["status","parts: string[]","changes: string[]","lines: string[]","findC8Path","runCommand","coverageCtx: CoverageContext | undefined","coverageEnv: Record<string, string>","fileResults: TestFileResult[]","results: TestBlockResult[]","fileResult: TestFileResult","statusIndicators","summary: TestRunSummary","parsedOptions: CoverageOptions","formatMarkdown","formatted: string[]","isInteractive","formatted: string[]"],"sources":["../src/cli/lib/shared.ts","../src/lib/reporter.ts","../src/lib/updater.ts","../src/lib/coverage.ts","../src/cli/commands/run.ts","../src/cli/commands/coverage.ts","../src/cli/commands/readme.ts","../src/cli/commands/docs.ts","../src/cli/cli.ts","../src/bin.ts"],"sourcesContent":["/**\n * Shared CLI utilities for consistent output formatting and color usage.\n *\n * This module provides:\n * - Color utilities via picocolors\n * - Commander.js help text styling\n * - Logging helpers for consistent output\n */\n\nimport type { Command } from 'commander';\nimport pc from 'picocolors';\n\n/**\n * Shared color utilities for consistent terminal output.\n */\nexport const colors = {\n success: (s: string) => pc.green(s),\n error: (s: string) => pc.red(s),\n warn: (s: string) => pc.yellow(s),\n info: (s: string) => pc.cyan(s),\n};\n\n/**\n * Status indicators with emoji.\n */\nexport const status = {\n pass: pc.green('✓'),\n fail: pc.red('✗'),\n skip: pc.yellow('○'),\n update: pc.yellow('↻'),\n};\n\n/**\n * Configure Commander.js with colored help text.\n * Applies consistent styling: cyan titles, green commands, yellow options.\n */\nexport function withColoredHelp<T extends Command>(cmd: T): T {\n cmd.configureHelp({\n styleTitle: (str) => pc.bold(pc.cyan(str)),\n styleCommandText: (str) => pc.green(str),\n styleOptionText: (str) => pc.yellow(str),\n showGlobalOptions: true,\n });\n return cmd;\n}\n\n/**\n * Format a duration in milliseconds for display.\n */\nexport function formatDuration(ms: number): string {\n if (ms < 1000) {\n return `${ms}ms`;\n }\n return `${(ms / 1000).toFixed(2)}s`;\n}\n\n/**\n * Log a warning message to stderr.\n */\nexport function logWarn(message: string): void {\n console.error(colors.warn(message));\n}\n\n/**\n * Log an error message to stderr.\n */\nexport function logError(message: string): void {\n console.error(colors.error(message));\n}\n","/**\n * Test result reporting utilities.\n *\n * Handles output formatting for test results, diffs, and summaries.\n */\n\nimport pc from 'picocolors';\nimport { createPatch } from 'diff';\nimport type { TestFileResult, TestRunSummary } from './types.js';\n\nexport interface ReporterOptions {\n diff: boolean;\n verbose: boolean;\n quiet: boolean;\n}\n\n// Status indicators for consistent output\nconst statusIcon = {\n pass: pc.green('✓'),\n fail: pc.red('✗'),\n};\n\n/**\n * Format a duration in milliseconds for display.\n */\nfunction formatDuration(ms: number): string {\n if (ms < 1000) {\n return `${ms}ms`;\n }\n return `${(ms / 1000).toFixed(2)}s`;\n}\n\n/**\n * Create a unified diff between expected and actual output.\n */\nexport function createDiff(expected: string, actual: string, filename: string): string {\n const patch = createPatch(filename, expected, actual, 'expected', 'actual');\n // Remove the header lines (first 4 lines)\n const lines = patch.split('\\n').slice(4);\n return lines\n .map((line) => {\n if (line.startsWith('+')) {\n return pc.green(line);\n }\n if (line.startsWith('-')) {\n return pc.red(line);\n }\n if (line.startsWith('@')) {\n return pc.cyan(line);\n }\n return line;\n })\n .join('\\n');\n}\n\n/**\n * Report results for a single file.\n */\nexport function reportFile(result: TestFileResult, options: ReporterOptions): void {\n const filename = result.file.path;\n const status = result.passed ? pc.green(pc.bold('PASS')) : pc.red(pc.bold('FAIL'));\n\n if (options.quiet && result.passed) {\n return;\n }\n\n // File header\n console.error(`${status} ${filename}`);\n\n // Individual block results\n for (const blockResult of result.results) {\n const name = blockResult.block.name ?? `Line ${blockResult.block.lineNumber}`;\n\n if (blockResult.passed) {\n if (!options.quiet) {\n console.error(` ${statusIcon.pass} ${name}`);\n }\n } else {\n console.error(` ${statusIcon.fail} ${name}`);\n\n // Show error details\n if (blockResult.error) {\n console.error(` ${pc.red(blockResult.error)}`);\n } else {\n // Exit code mismatch\n if (blockResult.actualExitCode !== blockResult.block.expectedExitCode) {\n console.error(\n ` Expected exit code ${blockResult.block.expectedExitCode}, got ${blockResult.actualExitCode}`,\n );\n }\n\n // Output mismatch with diff\n if (options.diff && blockResult.diff) {\n console.error('');\n console.error(blockResult.diff);\n }\n }\n }\n }\n\n console.error('');\n}\n\n/**\n * Report final summary.\n */\nexport function reportSummary(summary: TestRunSummary, _options: ReporterOptions): void {\n const parts: string[] = [];\n\n if (summary.totalPassed > 0) {\n parts.push(pc.green(`${summary.totalPassed} passed`));\n }\n if (summary.totalFailed > 0) {\n parts.push(pc.red(`${summary.totalFailed} failed`));\n }\n\n const duration = formatDuration(summary.duration);\n const line = `${parts.join(', ')} (${duration})`;\n\n // Summary goes to stdout (can be piped/parsed)\n console.log(line);\n}\n","import { writeFile } from 'atomically';\nimport type { TestFile, TestBlock, TestBlockResult } from './types.js';\n\n/**\n * Update a test file with actual output from test results.\n */\nexport async function updateTestFile(\n file: TestFile,\n results: TestBlockResult[],\n): Promise<{ updated: boolean; changes: string[] }> {\n let content = file.rawContent;\n const changes: string[] = [];\n\n // Process blocks in reverse order to maintain correct offsets\n const blocksWithResults = file.blocks\n .map((block, i) => ({ block, result: results[i] }))\n .reverse();\n\n for (const { block, result } of blocksWithResults) {\n if (!result) {\n continue;\n }\n\n if (result.passed) {\n continue; // Don't touch passing tests\n }\n\n if (result.error) {\n // Execution error, can't update\n continue;\n }\n\n // Build the new block content\n const newBlockContent = buildUpdatedBlock(block, result);\n\n // Find and replace the block in the file\n const blockStart = content.indexOf(block.rawContent);\n if (blockStart !== -1) {\n content =\n content.slice(0, blockStart) +\n newBlockContent +\n content.slice(blockStart + block.rawContent.length);\n\n changes.push(block.name ?? `Line ${block.lineNumber}`);\n }\n }\n\n if (changes.length > 0) {\n await writeFile(file.path, content);\n }\n\n return { updated: changes.length > 0, changes };\n}\n\n/**\n * Build an updated console block with new expected output.\n */\nfunction buildUpdatedBlock(block: TestBlock, result: TestBlockResult): string {\n // Reconstruct the command line(s)\n const commandLines = block.command.split('\\n').map((line, i) => {\n return i === 0 ? `$ ${line}` : `> ${line}`;\n });\n\n // Build the block\n const lines: string[] = ['```console', ...commandLines];\n\n // Add output if present\n const trimmedOutput = result.actualOutput.trimEnd();\n if (trimmedOutput) {\n lines.push(trimmedOutput);\n }\n\n // Add exit code\n lines.push(`? ${result.actualExitCode}`, '```');\n\n return lines.join('\\n');\n}\n","/**\n * Coverage collection for CLI subprocess testing.\n *\n * Uses c8 and NODE_V8_COVERAGE to collect coverage from spawned processes.\n */\n\nimport { spawn } from 'node:child_process';\nimport { mkdtemp, rm, access } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join, resolve } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport type { CoverageContext, CoverageConfig } from './types.js';\nimport { resolveCoverageConfig } from './config.js';\n\n/**\n * Find the c8 executable path.\n * Checks local node_modules/.bin first, then falls back to npx.\n */\nfunction findC8Path(): string {\n // Check common locations for local c8\n const localPaths = [\n resolve(process.cwd(), 'node_modules', '.bin', 'c8'),\n resolve(process.cwd(), '..', '..', 'node_modules', '.bin', 'c8'), // monorepo root\n ];\n\n for (const localPath of localPaths) {\n if (existsSync(localPath)) {\n return localPath;\n }\n }\n\n // Fall back to npx which will find c8 in node_modules\n return 'npx c8';\n}\n\n/**\n * Check if c8 is available in the current environment.\n */\nexport async function isC8Available(): Promise<boolean> {\n const c8Path = findC8Path();\n\n return new Promise((resolve) => {\n // Use npx to run c8 if we fell back to npx\n const isNpx = c8Path === 'npx c8';\n const command = isNpx ? 'npx' : c8Path;\n const args = isNpx ? ['c8', '--version'] : ['--version'];\n\n const proc = spawn(command, args, {\n shell: false,\n stdio: 'ignore',\n });\n proc.on('close', (code) => {\n resolve(code === 0);\n });\n proc.on('error', () => {\n resolve(false);\n });\n });\n}\n\n/**\n * Create a coverage context for collecting V8 coverage data.\n */\nexport async function createCoverageContext(config?: CoverageConfig): Promise<CoverageContext> {\n const options = resolveCoverageConfig(config);\n const tempDir = await mkdtemp(join(tmpdir(), 'tryscript-coverage-'));\n\n return {\n tempDir,\n options,\n };\n}\n\n/**\n * Get environment variables for enabling V8 coverage in spawned processes.\n */\nexport function getCoverageEnv(ctx: CoverageContext): Record<string, string> {\n return {\n NODE_V8_COVERAGE: ctx.tempDir,\n };\n}\n\n/**\n * Generate coverage report from collected V8 coverage data using c8.\n * Throws an error if coverage report generation fails.\n */\nexport async function generateCoverageReport(ctx: CoverageContext): Promise<void> {\n const { options, tempDir } = ctx;\n const c8Path = findC8Path();\n\n // Base args for c8 report\n const reportArgs = [\n 'report',\n '--temp-directory',\n tempDir,\n '--reports-dir',\n options.reportsDir,\n '--src',\n options.src,\n '--all',\n // Include patterns\n ...options.include.flatMap((pattern) => ['--include', pattern]),\n // Exclude patterns\n ...options.exclude.flatMap((pattern) => ['--exclude', pattern]),\n // Boolean flags (only add if explicitly set)\n ...(options.excludeNodeModules ? ['--exclude-node-modules'] : ['--no-exclude-node-modules']),\n ...(options.excludeAfterRemap ? ['--exclude-after-remap'] : []),\n ...(options.skipFull ? ['--skip-full'] : []),\n ...(options.allowExternal ? ['--allowExternal'] : []),\n ...(options.monocart ? ['--experimental-monocart'] : []),\n // Reporters\n ...options.reporters.flatMap((reporter) => ['--reporter', reporter]),\n ];\n\n // Handle 'npx c8' vs direct c8 path\n // Use shell: false to prevent glob expansion of patterns like dist/**\n const isNpx = c8Path === 'npx c8';\n const command = isNpx ? 'npx' : c8Path;\n const args = isNpx ? ['c8', ...reportArgs] : reportArgs;\n\n await new Promise<void>((resolvePromise, reject) => {\n const proc = spawn(command, args, {\n shell: false,\n stdio: 'inherit',\n });\n\n proc.on('close', (code) => {\n if (code === 0) {\n resolvePromise();\n } else {\n reject(new Error(`c8 report exited with code ${code}`));\n }\n });\n\n proc.on('error', (err) => {\n reject(new Error(`Failed to run c8 report: ${err.message}`));\n });\n });\n}\n\n/**\n * Clean up coverage context by removing the temporary directory.\n */\nexport async function cleanupCoverageContext(ctx: CoverageContext): Promise<void> {\n try {\n await access(ctx.tempDir);\n await rm(ctx.tempDir, { recursive: true, force: true });\n } catch {\n // Directory doesn't exist, nothing to clean up\n }\n}\n","/**\n * Run command - executes golden tests against CLI applications.\n *\n * Supports filtering, update mode, and detailed diff output for failures.\n */\n\nimport type { Command } from 'commander';\n\nimport { readFile } from 'node:fs/promises';\nimport fg from 'fast-glob';\nimport { loadConfig, mergeConfig } from '../../lib/config.js';\nimport { logWarn, logError, colors, status as statusIndicators } from '../lib/shared.js';\nimport { parseTestFile } from '../../lib/parser.js';\nimport {\n runBlock,\n createExecutionContext,\n cleanupExecutionContext,\n runAfterHook,\n} from '../../lib/runner.js';\nimport { matchOutput } from '../../lib/matcher.js';\nimport { createDiff, reportFile, reportSummary } from '../../lib/reporter.js';\nimport { updateTestFile } from '../../lib/updater.js';\nimport {\n isC8Available,\n createCoverageContext,\n getCoverageEnv,\n generateCoverageReport,\n cleanupCoverageContext,\n} from '../../lib/coverage.js';\nimport type {\n TestBlockResult,\n TestFileResult,\n TestRunSummary,\n CoverageContext,\n} from '../../lib/types.js';\n\ninterface RunOptions {\n update?: boolean;\n diff?: boolean;\n failFast?: boolean;\n filter?: string;\n verbose?: boolean;\n quiet?: boolean;\n coverage?: boolean;\n coverageDir?: string;\n coverageReporter?: string[];\n coverageExclude?: string[];\n coverageExcludeNodeModules?: boolean;\n coverageExcludeAfterRemap?: boolean;\n coverageSkipFull?: boolean;\n coverageAllowExternal?: boolean;\n coverageMonocart?: boolean;\n}\n\n/**\n * Register the run command.\n */\nexport function registerRunCommand(program: Command): void {\n program\n .command('run')\n .description('Run golden tests')\n .argument('[files...]', 'Test files to run (default: **/*.tryscript.md)')\n .option('--update', 'Update golden files with actual output')\n .option('--diff', 'Show diff on failure (default: true)')\n .option('--no-diff', 'Hide diff on failure')\n .option('--fail-fast', 'Stop on first failure')\n .option('--filter <pattern>', 'Filter tests by name pattern')\n .option('--verbose', 'Show detailed output including passing test output')\n .option('--quiet', 'Suppress non-essential output (only show failures)')\n .option('--coverage', 'Enable code coverage collection (requires c8)')\n .option('--coverage-dir <dir>', 'Coverage output directory (default: coverage-tryscript)')\n .option(\n '--coverage-reporter <reporter...>',\n 'Coverage reporters (default: text, html). Can be specified multiple times.',\n )\n .option(\n '--coverage-exclude <pattern...>',\n 'Patterns to exclude from coverage (c8 --exclude). Can be specified multiple times.',\n )\n .option(\n '--coverage-exclude-node-modules',\n 'Exclude node_modules from coverage (c8 --exclude-node-modules, default: true)',\n )\n .option(\n '--no-coverage-exclude-node-modules',\n 'Include node_modules in coverage (c8 --no-exclude-node-modules)',\n )\n .option(\n '--coverage-exclude-after-remap',\n 'Apply exclude logic after sourcemap remapping (c8 --exclude-after-remap)',\n )\n .option('--coverage-skip-full', 'Hide files with 100% coverage (c8 --skip-full)')\n .option('--coverage-allow-external', 'Allow files from outside cwd (c8 --allowExternal)')\n .option(\n '--coverage-monocart',\n 'Use monocart for accurate line counts, better for merging with vitest (c8 --experimental-monocart)',\n )\n .action(runCommand);\n}\n\nasync function runCommand(files: string[], options: RunOptions): Promise<void> {\n const startTime = Date.now();\n\n // Default options\n const opts = {\n diff: options.diff !== false,\n verbose: options.verbose ?? false,\n quiet: options.quiet ?? false,\n update: options.update ?? false,\n failFast: options.failFast ?? false,\n filter: options.filter,\n };\n\n // Find test files (fast-glob respects .gitignore by default)\n const patterns = files.length > 0 ? files : ['**/*.tryscript.md'];\n const testFiles = await fg(patterns, {\n ignore: ['**/node_modules/**', '**/dist/**'],\n absolute: true,\n dot: false,\n });\n\n if (testFiles.length === 0) {\n logWarn('No test files found');\n process.exit(1);\n }\n\n // Load global config\n const globalConfig = await loadConfig(process.cwd());\n\n // Setup coverage if enabled\n let coverageCtx: CoverageContext | undefined;\n let coverageEnv: Record<string, string> = {};\n\n if (options.coverage) {\n // Check if c8 is available\n const c8Available = await isC8Available();\n if (!c8Available) {\n logError('Coverage requires c8. Install with: npm install -D c8');\n process.exit(1);\n }\n\n // Create coverage context with CLI options overriding config\n coverageCtx = await createCoverageContext({\n ...globalConfig.coverage,\n reportsDir: options.coverageDir ?? globalConfig.coverage?.reportsDir,\n reporters: options.coverageReporter ?? globalConfig.coverage?.reporters,\n exclude: options.coverageExclude ?? globalConfig.coverage?.exclude,\n excludeNodeModules:\n options.coverageExcludeNodeModules ?? globalConfig.coverage?.excludeNodeModules,\n excludeAfterRemap:\n options.coverageExcludeAfterRemap ?? globalConfig.coverage?.excludeAfterRemap,\n skipFull: options.coverageSkipFull ?? globalConfig.coverage?.skipFull,\n allowExternal: options.coverageAllowExternal ?? globalConfig.coverage?.allowExternal,\n monocart: options.coverageMonocart ?? globalConfig.coverage?.monocart,\n });\n coverageEnv = getCoverageEnv(coverageCtx);\n }\n\n // Run tests\n const fileResults: TestFileResult[] = [];\n let shouldStop = false;\n\n for (const filePath of testFiles) {\n if (shouldStop) {\n break;\n }\n\n const content = await readFile(filePath, 'utf-8');\n const testFile = parseTestFile(content, filePath);\n const config = mergeConfig(globalConfig, testFile.config);\n\n // Filter blocks by name if specified\n let blocksToRun = testFile.blocks;\n if (opts.filter) {\n const filterPattern = new RegExp(opts.filter, 'i');\n blocksToRun = blocksToRun.filter((b) => (b.name ? filterPattern.test(b.name) : true));\n }\n\n // Handle \"only\" mode - if any block has only=true, run only those\n const onlyBlocks = blocksToRun.filter((b) => b.only);\n if (onlyBlocks.length > 0) {\n blocksToRun = onlyBlocks;\n }\n\n if (blocksToRun.length === 0) {\n continue;\n }\n\n const ctx = await createExecutionContext(config, filePath, coverageEnv);\n const results: TestBlockResult[] = [];\n\n try {\n for (const block of blocksToRun) {\n const result = await runBlock(block, ctx);\n\n // Skip checking for skipped tests\n if (result.skipped) {\n results.push(result);\n continue;\n }\n\n // Check if output matches expected\n // [ROOT] = test file directory, [CWD] = command working directory\n // If expectedStderr is set, compare stdout only (not combined output)\n const outputToCheck = block.expectedStderr\n ? (result.actualStdout ?? '')\n : result.actualOutput;\n const outputMatches = matchOutput(\n outputToCheck,\n block.expectedOutput,\n { root: ctx.testDir, cwd: ctx.cwd },\n config.patterns ?? {},\n );\n\n // Check stderr if expected (using actualStderr if available)\n let stderrMatches = true;\n if (block.expectedStderr) {\n stderrMatches = matchOutput(\n result.actualStderr ?? '',\n block.expectedStderr,\n { root: ctx.testDir, cwd: ctx.cwd },\n config.patterns ?? {},\n );\n }\n\n const exitCodeMatches = result.actualExitCode === block.expectedExitCode;\n result.passed = outputMatches && stderrMatches && exitCodeMatches && !result.error;\n\n if (!result.passed && opts.diff) {\n result.diff = createDiff(\n block.expectedOutput,\n result.actualOutput,\n `${filePath}:${block.lineNumber}`,\n );\n }\n\n results.push(result);\n\n if (!result.passed && opts.failFast) {\n shouldStop = true;\n break;\n }\n }\n\n // Run after hook if configured\n await runAfterHook(ctx);\n } finally {\n await cleanupExecutionContext(ctx);\n }\n\n const fileResult: TestFileResult = {\n file: testFile,\n results,\n passed: results.every((r) => r.passed),\n duration: results.reduce((sum, r) => sum + r.duration, 0),\n };\n\n fileResults.push(fileResult);\n reportFile(fileResult, opts);\n\n // Update mode\n if (opts.update && !fileResult.passed) {\n const { updated, changes } = await updateTestFile(testFile, results);\n if (updated) {\n console.error(colors.warn(` ${statusIndicators.update} Updated: ${changes.join(', ')}`));\n }\n }\n }\n\n // Summary\n const summary: TestRunSummary = {\n files: fileResults,\n totalPassed: fileResults.reduce((sum, f) => sum + f.results.filter((r) => r.passed).length, 0),\n totalFailed: fileResults.reduce((sum, f) => sum + f.results.filter((r) => !r.passed).length, 0),\n totalBlocks: fileResults.reduce((sum, f) => sum + f.results.length, 0),\n duration: Date.now() - startTime,\n };\n\n reportSummary(summary, opts);\n\n // Generate coverage report if enabled\n if (coverageCtx) {\n console.error('\\nGenerating coverage report...');\n try {\n await generateCoverageReport(coverageCtx);\n console.error(\n colors.success(`Coverage report written to ${coverageCtx.options.reportsDir}/`),\n );\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logError(`Failed to generate coverage report: ${message}`);\n } finally {\n await cleanupCoverageContext(coverageCtx);\n }\n }\n\n // Exit code\n process.exit(summary.totalFailed > 0 ? 1 : 0);\n}\n","/**\n * Coverage command - runs multiple commands with merged V8 coverage.\n *\n * This command provides a simple way to collect coverage from multiple sources\n * (e.g., unit tests + CLI tests) and generate a merged coverage report.\n *\n * Example usage:\n * tryscript coverage \"vitest run\" \"tryscript run tests/\"\n * tryscript coverage --monocart --reporters text,html \"vitest run\" \"node dist/bin.mjs run tests/\"\n */\n\nimport type { Command } from 'commander';\nimport { spawn } from 'node:child_process';\nimport { mkdtemp, rm } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join, resolve } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport { logError, logWarn, colors } from '../lib/shared.js';\n\ninterface CoverageOptions {\n reportsDir?: string;\n reporters?: string[];\n include?: string[];\n exclude?: string[];\n excludeNodeModules?: boolean;\n excludeAfterRemap?: boolean;\n skipFull?: boolean;\n allowExternal?: boolean;\n monocart?: boolean;\n src?: string;\n}\n\n/**\n * Register the coverage command.\n */\nexport function registerCoverageCommand(program: Command): void {\n program\n .command('coverage')\n .description('Run commands with merged V8 coverage')\n .argument('<commands...>', 'Commands to run (each will inherit coverage environment)')\n .option('--reports-dir <dir>', 'Coverage output directory (default: coverage)')\n .option(\n '--reporters <reporters>',\n 'Comma-separated coverage reporters (default: text,json,json-summary,lcov,html)',\n )\n .option('--include <patterns>', 'Comma-separated patterns to include in coverage')\n .option('--exclude <patterns>', 'Comma-separated patterns to exclude from coverage')\n .option('--exclude-node-modules', 'Exclude node_modules from coverage (default: true)', true)\n .option('--no-exclude-node-modules', 'Include node_modules in coverage')\n .option('--exclude-after-remap', 'Apply exclude logic after sourcemap remapping')\n .option('--skip-full', 'Hide files with 100% coverage')\n .option('--allow-external', 'Allow files from outside cwd')\n .option('--monocart', 'Use monocart for accurate line counts (recommended for merging)')\n .option('--src <dir>', 'Source directory for sourcemap remapping (default: src)')\n .action(coverageCommand);\n}\n\n/**\n * Run a command with inherited coverage environment.\n */\nasync function runCommand(\n command: string,\n env: Record<string, string>,\n): Promise<{ success: boolean; code: number }> {\n return new Promise((resolve) => {\n const proc = spawn(command, [], {\n stdio: 'inherit',\n env: { ...process.env, ...env },\n shell: true,\n });\n\n proc.on('close', (code) => {\n resolve({ success: code === 0, code: code ?? 1 });\n });\n\n proc.on('error', (err) => {\n logError(`Failed to run command: ${err.message}`);\n resolve({ success: false, code: 1 });\n });\n });\n}\n\n/**\n * Find the c8 executable path.\n * Can be overridden via TRYSCRIPT_C8_COMMAND env var for testing.\n */\nfunction findC8Path(): string | null {\n // Allow override for testing - when set, we trust it exists\n const override = process.env.TRYSCRIPT_C8_COMMAND;\n if (override) {\n return override;\n }\n\n const localPaths = [\n resolve(process.cwd(), 'node_modules', '.bin', 'c8'),\n resolve(process.cwd(), '..', '..', 'node_modules', '.bin', 'c8'),\n ];\n\n for (const localPath of localPaths) {\n if (existsSync(localPath)) {\n return localPath;\n }\n }\n\n return null;\n}\n\n/**\n * Generate c8 coverage report.\n */\nasync function generateReport(tempDir: string, options: CoverageOptions): Promise<boolean> {\n const c8Path = findC8Path();\n if (!c8Path) {\n logError('c8 not found. Install with: npm install -D c8');\n return false;\n }\n\n const reporters = options.reporters ?? ['text', 'json', 'json-summary', 'lcov', 'html'];\n const include = options.include ?? ['dist/**'];\n const exclude = options.exclude ?? [];\n\n const reportArgs = [\n 'report',\n '--temp-directory',\n tempDir,\n '--reports-dir',\n options.reportsDir ?? 'coverage',\n '--src',\n options.src ?? 'src',\n '--all',\n ...include.flatMap((pattern) => ['--include', pattern]),\n ...exclude.flatMap((pattern) => ['--exclude', pattern]),\n ...(options.excludeNodeModules !== false\n ? ['--exclude-node-modules']\n : ['--no-exclude-node-modules']),\n ...(options.excludeAfterRemap ? ['--exclude-after-remap'] : []),\n ...(options.skipFull ? ['--skip-full'] : []),\n ...(options.allowExternal ? ['--allowExternal'] : []),\n ...(options.monocart ? ['--experimental-monocart'] : []),\n ...reporters.flatMap((reporter) => ['--reporter', reporter]),\n ];\n\n return new Promise((resolve) => {\n const proc = spawn(c8Path, reportArgs, {\n stdio: 'inherit',\n shell: false,\n });\n\n proc.on('close', (code) => {\n resolve(code === 0);\n });\n\n proc.on('error', (err) => {\n logError(`Failed to generate coverage report: ${err.message}`);\n resolve(false);\n });\n });\n}\n\nasync function coverageCommand(commands: string[], options: CoverageOptions): Promise<void> {\n // Validate we have commands to run\n if (commands.length === 0) {\n logError('No commands specified. Usage: tryscript coverage \"cmd1\" \"cmd2\"');\n process.exit(1);\n }\n\n // Check for c8\n const c8Path = findC8Path();\n if (!c8Path) {\n logError('Coverage requires c8. Install with: npm install -D c8');\n process.exit(1);\n }\n\n // Create temp directory for V8 coverage data\n const coverageTemp = await mkdtemp(join(tmpdir(), 'tryscript-coverage-'));\n const coverageEnv = { NODE_V8_COVERAGE: coverageTemp };\n\n console.error(colors.info(`Collecting V8 coverage to ${coverageTemp}`));\n\n let hasFailures = false;\n\n try {\n // Run each command with shared coverage environment\n for (let i = 0; i < commands.length; i++) {\n const command = commands[i]!;\n console.error(\n colors.info(`\\n=== Running command ${i + 1}/${commands.length}: ${command} ===`),\n );\n\n const result = await runCommand(command, coverageEnv);\n if (!result.success) {\n logWarn(`Command exited with code ${result.code}: ${command}`);\n hasFailures = true;\n }\n }\n\n // Generate merged coverage report\n console.error(colors.info('\\n=== Generating merged coverage report ==='));\n\n // Parse comma-separated options\n const parsedOptions: CoverageOptions = {\n ...options,\n reporters: options.reporters\n ? typeof options.reporters === 'string'\n ? (options.reporters as string).split(',')\n : options.reporters\n : undefined,\n include: options.include\n ? typeof options.include === 'string'\n ? (options.include as string).split(',')\n : options.include\n : undefined,\n exclude: options.exclude\n ? typeof options.exclude === 'string'\n ? (options.exclude as string).split(',')\n : options.exclude\n : undefined,\n };\n\n const reportSuccess = await generateReport(coverageTemp, parsedOptions);\n if (!reportSuccess) {\n logError('Failed to generate coverage report');\n process.exit(1);\n }\n\n console.error(\n colors.success(`\\nCoverage report written to ${parsedOptions.reportsDir ?? 'coverage'}/`),\n );\n } finally {\n // Cleanup temp directory\n await rm(coverageTemp, { recursive: true, force: true });\n }\n\n // Exit with failure if any command failed\n if (hasFailures) {\n process.exit(1);\n }\n}\n","/**\n * Readme command - Display the README documentation.\n *\n * Shows the package README.md, formatted for the terminal when interactive,\n * or as plain text when piped.\n */\n\nimport type { Command } from 'commander';\n\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport pc from 'picocolors';\n\n/**\n * Get the path to the README.md file.\n * Works both during development and when installed as a package.\n */\nfunction getReadmePath(): string {\n const thisDir = dirname(fileURLToPath(import.meta.url));\n const dirName = thisDir.split(/[/\\\\]/).pop();\n\n if (dirName === 'dist') {\n // Bundled: dist -> package root -> README.md\n return join(dirname(thisDir), 'README.md');\n }\n\n // Development: src/cli/commands -> src/cli -> src -> package root -> README.md\n return join(dirname(dirname(dirname(thisDir))), 'README.md');\n}\n\n/**\n * Load the README content.\n */\nfunction loadReadme(): string {\n const readmePath = getReadmePath();\n try {\n return readFileSync(readmePath, 'utf-8');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to load README from ${readmePath}: ${message}`);\n }\n}\n\n/**\n * Apply basic terminal formatting to markdown content.\n * Colorizes headers, code blocks, and other elements for better readability.\n */\nfunction formatMarkdown(content: string, useColors: boolean): string {\n if (!useColors) {\n return content;\n }\n\n const lines = content.split('\\n');\n const formatted: string[] = [];\n let inCodeBlock = false;\n\n for (const line of lines) {\n // Track code blocks\n if (line.startsWith('```')) {\n inCodeBlock = !inCodeBlock;\n formatted.push(pc.dim(line));\n continue;\n }\n\n if (inCodeBlock) {\n formatted.push(pc.dim(line));\n continue;\n }\n\n // Headers\n if (line.startsWith('# ')) {\n formatted.push(pc.bold(pc.cyan(line)));\n continue;\n }\n if (line.startsWith('## ')) {\n formatted.push(pc.bold(pc.blue(line)));\n continue;\n }\n if (line.startsWith('### ')) {\n formatted.push(pc.bold(line));\n continue;\n }\n\n // Inline code (backticks)\n let formattedLine = line.replace(/`([^`]+)`/g, (_match, code: string) => {\n return pc.yellow(code);\n });\n\n // Bold text\n formattedLine = formattedLine.replace(/\\*\\*([^*]+)\\*\\*/g, (_match, text: string) => {\n return pc.bold(text);\n });\n\n // Links - show text in cyan, URL dimmed\n formattedLine = formattedLine.replace(\n /\\[([^\\]]+)\\]\\(([^)]+)\\)/g,\n (_match, text: string, url: string) => {\n return `${pc.cyan(text)} ${pc.dim(`(${url})`)}`;\n },\n );\n\n formatted.push(formattedLine);\n }\n\n return formatted.join('\\n');\n}\n\n/**\n * Check if stdout is an interactive terminal.\n */\nfunction isInteractive(): boolean {\n return process.stdout.isTTY === true;\n}\n\n/**\n * Display the README content.\n * Exported for use as the default command.\n */\nexport function showReadme(options?: { raw?: boolean; color?: boolean }): void {\n try {\n const readme = loadReadme();\n\n // Determine if we should colorize\n const shouldColorize = options?.color ?? (!options?.raw && isInteractive());\n\n const formatted = formatMarkdown(readme, shouldColorize);\n console.log(formatted);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(pc.red(`Error: ${message}`));\n process.exit(1);\n }\n}\n\n/**\n * Register the readme command.\n */\nexport function registerReadmeCommand(program: Command): void {\n program\n .command('readme')\n .description('Display README documentation')\n .option('--raw', 'Output raw markdown without formatting')\n .option('--color', 'Force colorized output (for testing)')\n .action(showReadme);\n}\n","/**\n * Docs command - Display the tryscript quick reference.\n *\n * Shows the tryscript-reference.md file, formatted for the terminal when interactive,\n * or as plain text when piped.\n */\n\nimport type { Command } from 'commander';\n\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport pc from 'picocolors';\n\n/**\n * Get the path to the tryscript-reference.md file.\n * Works both during development and when installed as a package.\n */\nfunction getDocsPath(): string {\n const thisDir = dirname(fileURLToPath(import.meta.url));\n const dirName = thisDir.split(/[/\\\\]/).pop();\n\n if (dirName === 'dist') {\n // Bundled: dist -> package root -> docs/tryscript-reference.md\n return join(dirname(thisDir), 'docs', 'tryscript-reference.md');\n }\n\n // Development: src/cli/commands -> src/cli -> src -> package root -> docs/tryscript-reference.md\n return join(dirname(dirname(dirname(thisDir))), 'docs', 'tryscript-reference.md');\n}\n\n/**\n * Load the docs content.\n */\nfunction loadDocs(): string {\n const docsPath = getDocsPath();\n try {\n return readFileSync(docsPath, 'utf-8');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to load reference docs from ${docsPath}: ${message}`);\n }\n}\n\n/**\n * Apply basic terminal formatting to markdown content.\n * Colorizes headers, code blocks, and other elements for better readability.\n */\nfunction formatMarkdown(content: string, useColors: boolean): string {\n if (!useColors) {\n return content;\n }\n\n const lines = content.split('\\n');\n const formatted: string[] = [];\n let inCodeBlock = false;\n\n for (const line of lines) {\n // Track code blocks\n if (line.startsWith('```')) {\n inCodeBlock = !inCodeBlock;\n formatted.push(pc.dim(line));\n continue;\n }\n\n if (inCodeBlock) {\n formatted.push(pc.dim(line));\n continue;\n }\n\n // Headers\n if (line.startsWith('# ')) {\n formatted.push(pc.bold(pc.cyan(line)));\n continue;\n }\n if (line.startsWith('## ')) {\n formatted.push(pc.bold(pc.blue(line)));\n continue;\n }\n if (line.startsWith('### ')) {\n formatted.push(pc.bold(line));\n continue;\n }\n\n // Inline code (backticks)\n let formattedLine = line.replace(/`([^`]+)`/g, (_match, code: string) => {\n return pc.yellow(code);\n });\n\n // Bold text\n formattedLine = formattedLine.replace(/\\*\\*([^*]+)\\*\\*/g, (_match, text: string) => {\n return pc.bold(text);\n });\n\n // Links - show text in cyan, URL dimmed\n formattedLine = formattedLine.replace(\n /\\[([^\\]]+)\\]\\(([^)]+)\\)/g,\n (_match, text: string, url: string) => {\n return `${pc.cyan(text)} ${pc.dim(`(${url})`)}`;\n },\n );\n\n formatted.push(formattedLine);\n }\n\n return formatted.join('\\n');\n}\n\n/**\n * Check if stdout is an interactive terminal.\n */\nfunction isInteractive(): boolean {\n return process.stdout.isTTY === true;\n}\n\n/**\n * Register the docs command.\n */\nexport function registerDocsCommand(program: Command): void {\n program\n .command('docs')\n .description('Display concise syntax reference')\n .option('--raw', 'Output raw markdown without formatting')\n .option('--color', 'Force colorized output (for testing)')\n .action((options: { raw?: boolean; color?: boolean }) => {\n try {\n const docs = loadDocs();\n\n // Determine if we should colorize\n const shouldColorize = options.color ?? (!options.raw && isInteractive());\n\n const formatted = formatMarkdown(docs, shouldColorize);\n console.log(formatted);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(pc.red(`Error: ${message}`));\n process.exit(1);\n }\n });\n}\n","/**\n * CLI entry point for tryscript.\n *\n * Configures Commander.js with colored help and registers all subcommands.\n */\n\nimport { Command } from 'commander';\nimport { VERSION } from '../index.js';\nimport { registerRunCommand } from './commands/run.js';\nimport { registerCoverageCommand } from './commands/coverage.js';\nimport { registerReadmeCommand } from './commands/readme.js';\nimport { registerDocsCommand } from './commands/docs.js';\nimport { withColoredHelp, logError } from './lib/shared.js';\n\nexport function run(argv: string[]): void {\n const program = withColoredHelp(\n new Command()\n .name('tryscript')\n .version(VERSION, '--version', 'Show version number')\n .description('Golden testing for CLI applications')\n .showHelpAfterError('(use --help for usage)'),\n );\n\n // Register subcommands\n registerRunCommand(program);\n registerCoverageCommand(program);\n registerReadmeCommand(program);\n registerDocsCommand(program);\n\n // Default action: show help when no command given\n program.action(() => {\n program.help();\n });\n\n program.parseAsync(argv).catch((err: Error) => {\n logError(`Error: ${err.message}`);\n process.exit(2);\n });\n}\n","#!/usr/bin/env node\nimport { run } from './cli/cli.js';\n\nrun(process.argv);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,MAAa,SAAS;CACpB,UAAU,MAAc,GAAG,MAAM,EAAE;CACnC,QAAQ,MAAc,GAAG,IAAI,EAAE;CAC/B,OAAO,MAAc,GAAG,OAAO,EAAE;CACjC,OAAO,MAAc,GAAG,KAAK,EAAE;CAChC;;;;AAKD,MAAa,SAAS;CACpB,MAAM,GAAG,MAAM,IAAI;CACnB,MAAM,GAAG,IAAI,IAAI;CACjB,MAAM,GAAG,OAAO,IAAI;CACpB,QAAQ,GAAG,OAAO,IAAI;CACvB;;;;;AAMD,SAAgB,gBAAmC,KAAW;AAC5D,KAAI,cAAc;EAChB,aAAa,QAAQ,GAAG,KAAK,GAAG,KAAK,IAAI,CAAC;EAC1C,mBAAmB,QAAQ,GAAG,MAAM,IAAI;EACxC,kBAAkB,QAAQ,GAAG,OAAO,IAAI;EACxC,mBAAmB;EACpB,CAAC;AACF,QAAO;;;;;AAgBT,SAAgB,QAAQ,SAAuB;AAC7C,SAAQ,MAAM,OAAO,KAAK,QAAQ,CAAC;;;;;AAMrC,SAAgB,SAAS,SAAuB;AAC9C,SAAQ,MAAM,OAAO,MAAM,QAAQ,CAAC;;;;;;;;;;AClDtC,MAAM,aAAa;CACjB,MAAM,GAAG,MAAM,IAAI;CACnB,MAAM,GAAG,IAAI,IAAI;CAClB;;;;AAKD,SAAS,eAAe,IAAoB;AAC1C,KAAI,KAAK,IACP,QAAO,GAAG,GAAG;AAEf,QAAO,IAAI,KAAK,KAAM,QAAQ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CAAuC,CACzD,QAAQ,YAAgD;AACvD,MAAI;GAMF,MAAM,YAAY,eALL,UAAU,EAGA,QAAQ,UAAU,CAAC,QAAQ,OAAO,eAAe,EAElB;AACtD,WAAQ,IAAI,UAAU;WACf,OAAO;GACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACtE,WAAQ,MAAM,GAAG,IAAI,UAAU,UAAU,CAAC;AAC1C,WAAQ,KAAK,EAAE;;GAEjB;;;;;;;;;;AC5HN,SAAgB,IAAI,MAAsB;CACxC,MAAM,UAAU,gBACd,IAAI,SAAS,CACV,KAAK,YAAY,CACjB,QAAQ,SAAS,aAAa,sBAAsB,CACpD,YAAY,sCAAsC,CAClD,mBAAmB,yBAAyB,CAChD;AAGD,oBAAmB,QAAQ;AAC3B,yBAAwB,QAAQ;AAChC,uBAAsB,QAAQ;AAC9B,qBAAoB,QAAQ;AAG5B,SAAQ,aAAa;AACnB,UAAQ,MAAM;GACd;AAEF,SAAQ,WAAW,KAAK,CAAC,OAAO,QAAe;AAC7C,WAAS,UAAU,IAAI,UAAU;AACjC,UAAQ,KAAK,EAAE;GACf;;;;;AClCJ,IAAI,QAAQ,KAAK"}
|
|
1
|
+
{"version":3,"file":"bin.mjs","names":["status","parts: string[]","changes: string[]","lines: string[]","currentFile: FileCoverage | null","lines: string[]","summary: CoverageSummary","findC8Path","runCommand","coverageCtx: CoverageContext | undefined","coverageEnv: Record<string, string>","fileResults: TestFileResult[]","results: TestBlockResult[]","fileResult: TestFileResult","statusIndicators","summary: TestRunSummary","parsedOptions: CoverageOptions","formatMarkdown","formatted: string[]","isInteractive","formatted: string[]"],"sources":["../src/cli/lib/shared.ts","../src/lib/reporter.ts","../src/lib/updater.ts","../src/lib/lcov.ts","../src/lib/coverage.ts","../src/cli/commands/run.ts","../src/cli/commands/coverage.ts","../src/cli/commands/readme.ts","../src/cli/commands/docs.ts","../src/cli/cli.ts","../src/bin.ts"],"sourcesContent":["/**\n * Shared CLI utilities for consistent output formatting and color usage.\n *\n * This module provides:\n * - Color utilities via picocolors\n * - Commander.js help text styling\n * - Logging helpers for consistent output\n */\n\nimport type { Command } from 'commander';\nimport pc from 'picocolors';\n\n/**\n * Shared color utilities for consistent terminal output.\n */\nexport const colors = {\n success: (s: string) => pc.green(s),\n error: (s: string) => pc.red(s),\n warn: (s: string) => pc.yellow(s),\n info: (s: string) => pc.cyan(s),\n};\n\n/**\n * Status indicators with emoji.\n */\nexport const status = {\n pass: pc.green('✓'),\n fail: pc.red('✗'),\n skip: pc.yellow('○'),\n update: pc.yellow('↻'),\n};\n\n/**\n * Configure Commander.js with colored help text.\n * Applies consistent styling: cyan titles, green commands, yellow options.\n */\nexport function withColoredHelp<T extends Command>(cmd: T): T {\n cmd.configureHelp({\n styleTitle: (str) => pc.bold(pc.cyan(str)),\n styleCommandText: (str) => pc.green(str),\n styleOptionText: (str) => pc.yellow(str),\n showGlobalOptions: true,\n });\n return cmd;\n}\n\n/**\n * Format a duration in milliseconds for display.\n */\nexport function formatDuration(ms: number): string {\n if (ms < 1000) {\n return `${ms}ms`;\n }\n return `${(ms / 1000).toFixed(2)}s`;\n}\n\n/**\n * Log a warning message to stderr.\n */\nexport function logWarn(message: string): void {\n console.error(colors.warn(message));\n}\n\n/**\n * Log an error message to stderr.\n */\nexport function logError(message: string): void {\n console.error(colors.error(message));\n}\n","/**\n * Test result reporting utilities.\n *\n * Handles output formatting for test results, diffs, and summaries.\n */\n\nimport pc from 'picocolors';\nimport { createPatch } from 'diff';\nimport type { TestFileResult, TestRunSummary } from './types.js';\n\nexport interface ReporterOptions {\n diff: boolean;\n verbose: boolean;\n quiet: boolean;\n}\n\n// Status indicators for consistent output\nconst statusIcon = {\n pass: pc.green('✓'),\n fail: pc.red('✗'),\n};\n\n/**\n * Format a duration in milliseconds for display.\n */\nfunction formatDuration(ms: number): string {\n if (ms < 1000) {\n return `${ms}ms`;\n }\n return `${(ms / 1000).toFixed(2)}s`;\n}\n\n/**\n * Create a unified diff between expected and actual output.\n */\nexport function createDiff(expected: string, actual: string, filename: string): string {\n const patch = createPatch(filename, expected, actual, 'expected', 'actual');\n // Remove the header lines (first 4 lines)\n const lines = patch.split('\\n').slice(4);\n return lines\n .map((line) => {\n if (line.startsWith('+')) {\n return pc.green(line);\n }\n if (line.startsWith('-')) {\n return pc.red(line);\n }\n if (line.startsWith('@')) {\n return pc.cyan(line);\n }\n return line;\n })\n .join('\\n');\n}\n\n/**\n * Report results for a single file.\n */\nexport function reportFile(result: TestFileResult, options: ReporterOptions): void {\n const filename = result.file.path;\n const status = result.passed ? pc.green(pc.bold('PASS')) : pc.red(pc.bold('FAIL'));\n\n if (options.quiet && result.passed) {\n return;\n }\n\n // File header\n console.error(`${status} ${filename}`);\n\n // Individual block results\n for (const blockResult of result.results) {\n const name = blockResult.block.name ?? `Line ${blockResult.block.lineNumber}`;\n\n if (blockResult.passed) {\n if (!options.quiet) {\n console.error(` ${statusIcon.pass} ${name}`);\n }\n } else {\n console.error(` ${statusIcon.fail} ${name}`);\n\n // Show error details\n if (blockResult.error) {\n console.error(` ${pc.red(blockResult.error)}`);\n } else {\n // Exit code mismatch\n if (blockResult.actualExitCode !== blockResult.block.expectedExitCode) {\n console.error(\n ` Expected exit code ${blockResult.block.expectedExitCode}, got ${blockResult.actualExitCode}`,\n );\n }\n\n // Output mismatch with diff\n if (options.diff && blockResult.diff) {\n console.error('');\n console.error(blockResult.diff);\n }\n }\n }\n }\n\n console.error('');\n}\n\n/**\n * Report final summary.\n */\nexport function reportSummary(summary: TestRunSummary, _options: ReporterOptions): void {\n const parts: string[] = [];\n\n if (summary.totalPassed > 0) {\n parts.push(pc.green(`${summary.totalPassed} passed`));\n }\n if (summary.totalFailed > 0) {\n parts.push(pc.red(`${summary.totalFailed} failed`));\n }\n\n const duration = formatDuration(summary.duration);\n const line = `${parts.join(', ')} (${duration})`;\n\n // Summary goes to stdout (can be piped/parsed)\n console.log(line);\n}\n","import { writeFile } from 'atomically';\nimport type { TestFile, TestBlock, TestBlockResult } from './types.js';\n\n/**\n * Update a test file with actual output from test results.\n */\nexport async function updateTestFile(\n file: TestFile,\n results: TestBlockResult[],\n): Promise<{ updated: boolean; changes: string[] }> {\n let content = file.rawContent;\n const changes: string[] = [];\n\n // Process blocks in reverse order to maintain correct offsets\n const blocksWithResults = file.blocks\n .map((block, i) => ({ block, result: results[i] }))\n .reverse();\n\n for (const { block, result } of blocksWithResults) {\n if (!result) {\n continue;\n }\n\n if (result.passed) {\n continue; // Don't touch passing tests\n }\n\n if (result.error) {\n // Execution error, can't update\n continue;\n }\n\n // Build the new block content\n const newBlockContent = buildUpdatedBlock(block, result);\n\n // Find and replace the block in the file\n const blockStart = content.indexOf(block.rawContent);\n if (blockStart !== -1) {\n content =\n content.slice(0, blockStart) +\n newBlockContent +\n content.slice(blockStart + block.rawContent.length);\n\n changes.push(block.name ?? `Line ${block.lineNumber}`);\n }\n }\n\n if (changes.length > 0) {\n await writeFile(file.path, content);\n }\n\n return { updated: changes.length > 0, changes };\n}\n\n/**\n * Build an updated console block with new expected output.\n */\nfunction buildUpdatedBlock(block: TestBlock, result: TestBlockResult): string {\n // Reconstruct the command line(s)\n const commandLines = block.command.split('\\n').map((line, i) => {\n return i === 0 ? `$ ${line}` : `> ${line}`;\n });\n\n // Build the block\n const lines: string[] = ['```console', ...commandLines];\n\n // Add output if present\n const trimmedOutput = result.actualOutput.trimEnd();\n if (trimmedOutput) {\n lines.push(trimmedOutput);\n }\n\n // Add exit code\n lines.push(`? ${result.actualExitCode}`, '```');\n\n return lines.join('\\n');\n}\n","/**\n * LCOV parsing, merging, and writing utilities.\n *\n * LCOV format reference:\n * - SF: Source file path\n * - DA:linenum,hitcount - Line data\n * - FN:linenum,funcname - Function definition\n * - FNDA:hitcount,funcname - Function hit data\n * - FNF: Functions found count\n * - FNH: Functions hit count\n * - BRF: Branches found count\n * - BRH: Branches hit count\n * - BRDA:line,block,branch,taken - Branch data\n * - LF: Lines found count\n * - LH: Lines hit count\n * - end_of_record - End of file record\n */\n\nimport { readFileSync, writeFileSync, mkdirSync } from 'node:fs';\nimport { dirname } from 'node:path';\n\n/** Coverage data for a single line */\ninterface LineData {\n lineNumber: number;\n hitCount: number;\n}\n\n/** Coverage data for a function */\ninterface FunctionData {\n name: string;\n lineNumber: number;\n hitCount: number;\n}\n\n/** Coverage data for a branch */\ninterface BranchData {\n line: number;\n block: number;\n branch: number;\n taken: number; // -1 means not taken, 0+ means taken count\n}\n\n/** Coverage data for a single source file */\ninterface FileCoverage {\n path: string;\n lines: Map<number, LineData>;\n functions: Map<string, FunctionData>;\n branches: BranchData[];\n}\n\n/** Parsed LCOV data */\nexport interface LcovData {\n files: Map<string, FileCoverage>;\n}\n\n/**\n * Parse LCOV content into structured data.\n */\nexport function parseLcov(content: string): LcovData {\n const files = new Map<string, FileCoverage>();\n let currentFile: FileCoverage | null = null;\n\n for (const line of content.split('\\n')) {\n const trimmed = line.trim();\n\n if (trimmed.startsWith('SF:')) {\n const path = trimmed.slice(3);\n currentFile = {\n path,\n lines: new Map(),\n functions: new Map(),\n branches: [],\n };\n files.set(path, currentFile);\n } else if (trimmed.startsWith('DA:') && currentFile) {\n // DA:linenum,hitcount\n const parts = trimmed.slice(3).split(',');\n const lineNumber = parseInt(parts[0]!, 10);\n const hitCount = parseInt(parts[1]!, 10);\n currentFile.lines.set(lineNumber, { lineNumber, hitCount });\n } else if (trimmed.startsWith('FN:') && currentFile) {\n // FN:linenum,funcname\n const parts = trimmed.slice(3).split(',');\n const lineNumber = parseInt(parts[0]!, 10);\n const name = parts.slice(1).join(','); // Function name might contain commas\n if (!currentFile.functions.has(name)) {\n currentFile.functions.set(name, { name, lineNumber, hitCount: 0 });\n } else {\n currentFile.functions.get(name)!.lineNumber = lineNumber;\n }\n } else if (trimmed.startsWith('FNDA:') && currentFile) {\n // FNDA:hitcount,funcname\n const parts = trimmed.slice(5).split(',');\n const hitCount = parseInt(parts[0]!, 10);\n const name = parts.slice(1).join(',');\n if (currentFile.functions.has(name)) {\n currentFile.functions.get(name)!.hitCount = hitCount;\n } else {\n currentFile.functions.set(name, { name, lineNumber: 0, hitCount });\n }\n } else if (trimmed.startsWith('BRDA:') && currentFile) {\n // BRDA:line,block,branch,taken\n const parts = trimmed.slice(5).split(',');\n currentFile.branches.push({\n line: parseInt(parts[0]!, 10),\n block: parseInt(parts[1]!, 10),\n branch: parseInt(parts[2]!, 10),\n taken: parts[3] === '-' ? -1 : parseInt(parts[3]!, 10),\n });\n } else if (trimmed === 'end_of_record') {\n currentFile = null;\n }\n // Ignore FNF, FNH, BRF, BRH, LF, LH - we'll recalculate these\n }\n\n return { files };\n}\n\n/**\n * Merge multiple LCOV data structures, taking max hit counts.\n */\nexport function mergeLcov(...lcovs: LcovData[]): LcovData {\n const merged = new Map<string, FileCoverage>();\n\n for (const lcov of lcovs) {\n for (const [path, file] of lcov.files) {\n if (!merged.has(path)) {\n // Clone the file data\n merged.set(path, {\n path,\n lines: new Map(file.lines),\n functions: new Map(file.functions),\n branches: [...file.branches],\n });\n } else {\n const existing = merged.get(path)!;\n\n // Merge lines - take max hit count\n for (const [lineNum, lineData] of file.lines) {\n const existingLine = existing.lines.get(lineNum);\n if (existingLine) {\n existingLine.hitCount = Math.max(existingLine.hitCount, lineData.hitCount);\n } else {\n existing.lines.set(lineNum, { ...lineData });\n }\n }\n\n // Merge functions - take max hit count\n for (const [name, funcData] of file.functions) {\n const existingFunc = existing.functions.get(name);\n if (existingFunc) {\n existingFunc.hitCount = Math.max(existingFunc.hitCount, funcData.hitCount);\n } else {\n existing.functions.set(name, { ...funcData });\n }\n }\n\n // Merge branches - match by line/block/branch, take max\n for (const branch of file.branches) {\n const existingBranch = existing.branches.find(\n (b) => b.line === branch.line && b.block === branch.block && b.branch === branch.branch,\n );\n if (existingBranch) {\n if (branch.taken >= 0) {\n existingBranch.taken =\n existingBranch.taken >= 0\n ? Math.max(existingBranch.taken, branch.taken)\n : branch.taken;\n }\n } else {\n existing.branches.push({ ...branch });\n }\n }\n }\n }\n }\n\n return { files: merged };\n}\n\n/**\n * Convert LCOV data back to LCOV format string.\n */\nexport function formatLcov(lcov: LcovData): string {\n const lines: string[] = [];\n\n for (const file of lcov.files.values()) {\n lines.push(`SF:${file.path}`);\n\n // Functions (FN entries first, then FNDA)\n const sortedFunctions = [...file.functions.values()].sort(\n (a, b) => a.lineNumber - b.lineNumber,\n );\n for (const func of sortedFunctions) {\n lines.push(`FN:${func.lineNumber},${func.name}`);\n }\n for (const func of sortedFunctions) {\n lines.push(`FNDA:${func.hitCount},${func.name}`);\n }\n\n // Function summary\n const fnf = file.functions.size;\n const fnh = [...file.functions.values()].filter((f) => f.hitCount > 0).length;\n lines.push(`FNF:${fnf}`);\n lines.push(`FNH:${fnh}`);\n\n // Branches\n for (const branch of file.branches) {\n const taken = branch.taken < 0 ? '-' : branch.taken.toString();\n lines.push(`BRDA:${branch.line},${branch.block},${branch.branch},${taken}`);\n }\n\n // Branch summary\n const brf = file.branches.length;\n const brh = file.branches.filter((b) => b.taken > 0).length;\n lines.push(`BRF:${brf}`);\n lines.push(`BRH:${brh}`);\n\n // Lines (sorted by line number)\n const sortedLines = [...file.lines.values()].sort((a, b) => a.lineNumber - b.lineNumber);\n for (const line of sortedLines) {\n lines.push(`DA:${line.lineNumber},${line.hitCount}`);\n }\n\n // Line summary\n const lf = file.lines.size;\n const lh = [...file.lines.values()].filter((l) => l.hitCount > 0).length;\n lines.push(`LF:${lf}`);\n lines.push(`LH:${lh}`);\n\n lines.push('end_of_record');\n }\n\n return lines.join('\\n') + '\\n';\n}\n\n/** Coverage summary metrics */\ninterface CoverageMetrics {\n total: number;\n covered: number;\n skipped: number;\n pct: number;\n}\n\n/** Coverage summary for a file or total */\ninterface FileSummary {\n lines: CoverageMetrics;\n statements: CoverageMetrics;\n functions: CoverageMetrics;\n branches: CoverageMetrics;\n branchesTrue?: CoverageMetrics;\n}\n\n/** JSON summary format (compatible with istanbul/vitest) */\nexport interface CoverageSummary {\n total: FileSummary;\n [filePath: string]: FileSummary;\n}\n\n/**\n * Convert LCOV data to JSON summary format (compatible with istanbul/vitest).\n */\nexport function lcovToJsonSummary(lcov: LcovData): CoverageSummary {\n const withPct = (total: number, covered: number): CoverageMetrics => ({\n total,\n covered,\n skipped: 0,\n pct: total > 0 ? parseFloat(((covered / total) * 100).toFixed(2)) : 100,\n });\n\n const totals = {\n lines: { total: 0, covered: 0 },\n functions: { total: 0, covered: 0 },\n branches: { total: 0, covered: 0 },\n };\n\n const summary: CoverageSummary = {\n total: {\n lines: withPct(0, 0),\n statements: withPct(0, 0),\n functions: withPct(0, 0),\n branches: withPct(0, 0),\n branchesTrue: { total: 0, covered: 0, skipped: 0, pct: 100 },\n },\n };\n\n for (const file of lcov.files.values()) {\n const linesTotal = file.lines.size;\n const linesCovered = [...file.lines.values()].filter((l) => l.hitCount > 0).length;\n const funcsTotal = file.functions.size;\n const funcsCovered = [...file.functions.values()].filter((f) => f.hitCount > 0).length;\n const branchesTotal = file.branches.length;\n const branchesCovered = file.branches.filter((b) => b.taken > 0).length;\n\n summary[file.path] = {\n lines: withPct(linesTotal, linesCovered),\n statements: withPct(linesTotal, linesCovered), // statements ≈ lines for LCOV\n functions: withPct(funcsTotal, funcsCovered),\n branches: withPct(branchesTotal, branchesCovered),\n };\n\n totals.lines.total += linesTotal;\n totals.lines.covered += linesCovered;\n totals.functions.total += funcsTotal;\n totals.functions.covered += funcsCovered;\n totals.branches.total += branchesTotal;\n totals.branches.covered += branchesCovered;\n }\n\n summary.total = {\n lines: withPct(totals.lines.total, totals.lines.covered),\n statements: withPct(totals.lines.total, totals.lines.covered),\n functions: withPct(totals.functions.total, totals.functions.covered),\n branches: withPct(totals.branches.total, totals.branches.covered),\n branchesTrue: { total: 0, covered: 0, skipped: 0, pct: 100 },\n };\n\n return summary;\n}\n\n/**\n * Read and parse an LCOV file.\n */\nexport function readLcovFile(path: string): LcovData {\n const content = readFileSync(path, 'utf8');\n return parseLcov(content);\n}\n\n/**\n * Write LCOV data to a file.\n */\nexport function writeLcovFile(path: string, lcov: LcovData): void {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, formatLcov(lcov));\n}\n\n/**\n * Write JSON summary to a file.\n */\nexport function writeJsonSummary(path: string, summary: CoverageSummary): void {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, JSON.stringify(summary, null, 2));\n}\n","/**\n * Coverage collection for CLI subprocess testing.\n *\n * Uses c8 and NODE_V8_COVERAGE to collect coverage from spawned processes.\n */\n\nimport { spawn } from 'node:child_process';\nimport { mkdtemp, rm, access } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join, resolve } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport type { CoverageContext, CoverageConfig } from './types.js';\nimport { resolveCoverageConfig } from './config.js';\nimport {\n readLcovFile,\n mergeLcov,\n writeLcovFile,\n lcovToJsonSummary,\n writeJsonSummary,\n} from './lcov.js';\n\n/**\n * Find the c8 executable path.\n * Checks local node_modules/.bin first, then falls back to npx.\n */\nfunction findC8Path(): string {\n // Check common locations for local c8\n const localPaths = [\n resolve(process.cwd(), 'node_modules', '.bin', 'c8'),\n resolve(process.cwd(), '..', '..', 'node_modules', '.bin', 'c8'), // monorepo root\n ];\n\n for (const localPath of localPaths) {\n if (existsSync(localPath)) {\n return localPath;\n }\n }\n\n // Fall back to npx which will find c8 in node_modules\n return 'npx c8';\n}\n\n/**\n * Check if c8 is available in the current environment.\n */\nexport async function isC8Available(): Promise<boolean> {\n const c8Path = findC8Path();\n\n return new Promise((resolve) => {\n // Use npx to run c8 if we fell back to npx\n const isNpx = c8Path === 'npx c8';\n const command = isNpx ? 'npx' : c8Path;\n const args = isNpx ? ['c8', '--version'] : ['--version'];\n\n const proc = spawn(command, args, {\n shell: false,\n stdio: 'ignore',\n });\n proc.on('close', (code) => {\n resolve(code === 0);\n });\n proc.on('error', () => {\n resolve(false);\n });\n });\n}\n\n/**\n * Create a coverage context for collecting V8 coverage data.\n */\nexport async function createCoverageContext(config?: CoverageConfig): Promise<CoverageContext> {\n const options = resolveCoverageConfig(config);\n const tempDir = await mkdtemp(join(tmpdir(), 'tryscript-coverage-'));\n\n return {\n tempDir,\n options,\n };\n}\n\n/**\n * Get environment variables for enabling V8 coverage in spawned processes.\n */\nexport function getCoverageEnv(ctx: CoverageContext): Record<string, string> {\n return {\n NODE_V8_COVERAGE: ctx.tempDir,\n };\n}\n\n/**\n * Generate coverage report from collected V8 coverage data using c8.\n * Throws an error if coverage report generation fails.\n */\nexport async function generateCoverageReport(ctx: CoverageContext): Promise<void> {\n const { options, tempDir } = ctx;\n const c8Path = findC8Path();\n\n // Base args for c8 report\n const reportArgs = [\n 'report',\n '--temp-directory',\n tempDir,\n '--reports-dir',\n options.reportsDir,\n '--src',\n options.src,\n '--all',\n // Include patterns\n ...options.include.flatMap((pattern) => ['--include', pattern]),\n // Exclude patterns\n ...options.exclude.flatMap((pattern) => ['--exclude', pattern]),\n // Boolean flags (only add if explicitly set)\n ...(options.excludeNodeModules ? ['--exclude-node-modules'] : ['--no-exclude-node-modules']),\n ...(options.excludeAfterRemap ? ['--exclude-after-remap'] : []),\n ...(options.skipFull ? ['--skip-full'] : []),\n ...(options.allowExternal ? ['--allowExternal'] : []),\n ...(options.monocart ? ['--experimental-monocart'] : []),\n // Reporters\n ...options.reporters.flatMap((reporter) => ['--reporter', reporter]),\n ];\n\n // Handle 'npx c8' vs direct c8 path\n // Use shell: false to prevent glob expansion of patterns like dist/**\n const isNpx = c8Path === 'npx c8';\n const command = isNpx ? 'npx' : c8Path;\n const args = isNpx ? ['c8', ...reportArgs] : reportArgs;\n\n await new Promise<void>((resolvePromise, reject) => {\n const proc = spawn(command, args, {\n shell: false,\n stdio: 'inherit',\n });\n\n proc.on('close', (code) => {\n if (code === 0) {\n resolvePromise();\n } else {\n reject(new Error(`c8 report exited with code ${code}`));\n }\n });\n\n proc.on('error', (err) => {\n reject(new Error(`Failed to run c8 report: ${err.message}`));\n });\n });\n}\n\n/**\n * Clean up coverage context by removing the temporary directory.\n */\nexport async function cleanupCoverageContext(ctx: CoverageContext): Promise<void> {\n try {\n await access(ctx.tempDir);\n await rm(ctx.tempDir, { recursive: true, force: true });\n } catch {\n // Directory doesn't exist, nothing to clean up\n }\n}\n\n/**\n * Merge external LCOV file with generated coverage.\n * Reads the generated lcov.info, merges with external LCOV, and writes back.\n * Also generates coverage-summary.json for badge generation.\n *\n * @returns Object with merged coverage percentages, or null if merge failed\n */\nexport function mergeExternalCoverage(\n reportsDir: string,\n externalLcovPath: string,\n): { lines: number; functions: number } | null {\n const generatedLcovPath = join(reportsDir, 'lcov.info');\n\n if (!existsSync(externalLcovPath)) {\n console.error(`External LCOV file not found: ${externalLcovPath}`);\n return null;\n }\n\n if (!existsSync(generatedLcovPath)) {\n console.error(`Generated LCOV file not found: ${generatedLcovPath}`);\n console.error('Make sure \"lcov\" is included in reporters');\n return null;\n }\n\n // Read and merge LCOV files\n const externalLcov = readLcovFile(externalLcovPath);\n const generatedLcov = readLcovFile(generatedLcovPath);\n const mergedLcov = mergeLcov(externalLcov, generatedLcov);\n\n // Write merged LCOV\n writeLcovFile(generatedLcovPath, mergedLcov);\n\n // Write JSON summary from merged data\n const summary = lcovToJsonSummary(mergedLcov);\n writeJsonSummary(join(reportsDir, 'coverage-summary.json'), summary);\n\n return {\n lines: summary.total.lines.pct,\n functions: summary.total.functions.pct,\n };\n}\n","/**\n * Run command - executes golden tests against CLI applications.\n *\n * Supports filtering, update mode, and detailed diff output for failures.\n */\n\nimport type { Command } from 'commander';\n\nimport { readFile } from 'node:fs/promises';\nimport fg from 'fast-glob';\nimport { loadConfig, mergeConfig } from '../../lib/config.js';\nimport { logWarn, logError, colors, status as statusIndicators } from '../lib/shared.js';\nimport { parseTestFile } from '../../lib/parser.js';\nimport {\n runBlock,\n createExecutionContext,\n cleanupExecutionContext,\n runAfterHook,\n} from '../../lib/runner.js';\nimport { matchOutput } from '../../lib/matcher.js';\nimport { createDiff, reportFile, reportSummary } from '../../lib/reporter.js';\nimport { updateTestFile } from '../../lib/updater.js';\nimport {\n isC8Available,\n createCoverageContext,\n getCoverageEnv,\n generateCoverageReport,\n cleanupCoverageContext,\n mergeExternalCoverage,\n} from '../../lib/coverage.js';\nimport type {\n TestBlockResult,\n TestFileResult,\n TestRunSummary,\n CoverageContext,\n} from '../../lib/types.js';\n\ninterface RunOptions {\n update?: boolean;\n diff?: boolean;\n failFast?: boolean;\n filter?: string;\n verbose?: boolean;\n quiet?: boolean;\n coverage?: boolean;\n coverageDir?: string;\n coverageReporter?: string[];\n coverageExclude?: string[];\n coverageExcludeNodeModules?: boolean;\n coverageExcludeAfterRemap?: boolean;\n coverageSkipFull?: boolean;\n coverageAllowExternal?: boolean;\n coverageMonocart?: boolean;\n mergeLcov?: string;\n}\n\n/**\n * Register the run command.\n */\nexport function registerRunCommand(program: Command): void {\n program\n .command('run')\n .description('Run golden tests')\n .argument('[files...]', 'Test files to run (default: **/*.tryscript.md)')\n .option('--update', 'Update golden files with actual output')\n .option('--diff', 'Show diff on failure (default: true)')\n .option('--no-diff', 'Hide diff on failure')\n .option('--fail-fast', 'Stop on first failure')\n .option('--filter <pattern>', 'Filter tests by name pattern')\n .option('--verbose', 'Show detailed output including passing test output')\n .option('--quiet', 'Suppress non-essential output (only show failures)')\n .option('--coverage', 'Enable code coverage collection (requires c8)')\n .option('--coverage-dir <dir>', 'Coverage output directory (default: coverage-tryscript)')\n .option(\n '--coverage-reporter <reporter...>',\n 'Coverage reporters (default: text, html). Can be specified multiple times.',\n )\n .option(\n '--coverage-exclude <pattern...>',\n 'Patterns to exclude from coverage (c8 --exclude). Can be specified multiple times.',\n )\n .option(\n '--coverage-exclude-node-modules',\n 'Exclude node_modules from coverage (c8 --exclude-node-modules, default: true)',\n )\n .option(\n '--no-coverage-exclude-node-modules',\n 'Include node_modules in coverage (c8 --no-exclude-node-modules)',\n )\n .option(\n '--coverage-exclude-after-remap',\n 'Apply exclude logic after sourcemap remapping (c8 --exclude-after-remap)',\n )\n .option('--coverage-skip-full', 'Hide files with 100% coverage (c8 --skip-full)')\n .option('--coverage-allow-external', 'Allow files from outside cwd (c8 --allowExternal)')\n .option(\n '--coverage-monocart',\n 'Use monocart for accurate line counts, better for merging with vitest (c8 --experimental-monocart)',\n )\n .option(\n '--merge-lcov <path>',\n 'Merge coverage from an existing LCOV file (e.g., from vitest --coverage)',\n )\n .action(runCommand);\n}\n\nasync function runCommand(files: string[], options: RunOptions): Promise<void> {\n const startTime = Date.now();\n\n // Default options\n const opts = {\n diff: options.diff !== false,\n verbose: options.verbose ?? false,\n quiet: options.quiet ?? false,\n update: options.update ?? false,\n failFast: options.failFast ?? false,\n filter: options.filter,\n };\n\n // Find test files (fast-glob respects .gitignore by default)\n const patterns = files.length > 0 ? files : ['**/*.tryscript.md'];\n const testFiles = await fg(patterns, {\n ignore: ['**/node_modules/**', '**/dist/**'],\n absolute: true,\n dot: false,\n });\n\n if (testFiles.length === 0) {\n logWarn('No test files found');\n process.exit(1);\n }\n\n // Load global config\n const globalConfig = await loadConfig(process.cwd());\n\n // Setup coverage if enabled\n let coverageCtx: CoverageContext | undefined;\n let coverageEnv: Record<string, string> = {};\n\n if (options.coverage) {\n // Check if c8 is available\n const c8Available = await isC8Available();\n if (!c8Available) {\n logError('Coverage requires c8. Install with: npm install -D c8');\n process.exit(1);\n }\n\n // Create coverage context with CLI options overriding config\n // If --merge-lcov is specified, ensure lcov reporter is included\n let reporters = options.coverageReporter ?? globalConfig.coverage?.reporters;\n if (options.mergeLcov) {\n // If no explicit reporters, use defaults plus lcov\n if (!reporters) {\n reporters = ['text', 'html', 'lcov'];\n } else if (!reporters.includes('lcov')) {\n reporters = [...reporters, 'lcov'];\n }\n }\n\n coverageCtx = await createCoverageContext({\n ...globalConfig.coverage,\n reportsDir: options.coverageDir ?? globalConfig.coverage?.reportsDir,\n reporters,\n exclude: options.coverageExclude ?? globalConfig.coverage?.exclude,\n excludeNodeModules:\n options.coverageExcludeNodeModules ?? globalConfig.coverage?.excludeNodeModules,\n excludeAfterRemap:\n options.coverageExcludeAfterRemap ?? globalConfig.coverage?.excludeAfterRemap,\n skipFull: options.coverageSkipFull ?? globalConfig.coverage?.skipFull,\n allowExternal: options.coverageAllowExternal ?? globalConfig.coverage?.allowExternal,\n monocart: options.coverageMonocart ?? globalConfig.coverage?.monocart,\n mergeLcov: options.mergeLcov ?? globalConfig.coverage?.mergeLcov,\n });\n coverageEnv = getCoverageEnv(coverageCtx);\n }\n\n // Run tests\n const fileResults: TestFileResult[] = [];\n let shouldStop = false;\n\n for (const filePath of testFiles) {\n if (shouldStop) {\n break;\n }\n\n const content = await readFile(filePath, 'utf-8');\n const testFile = parseTestFile(content, filePath);\n const config = mergeConfig(globalConfig, testFile.config);\n\n // Filter blocks by name if specified\n let blocksToRun = testFile.blocks;\n if (opts.filter) {\n const filterPattern = new RegExp(opts.filter, 'i');\n blocksToRun = blocksToRun.filter((b) => (b.name ? filterPattern.test(b.name) : true));\n }\n\n // Handle \"only\" mode - if any block has only=true, run only those\n const onlyBlocks = blocksToRun.filter((b) => b.only);\n if (onlyBlocks.length > 0) {\n blocksToRun = onlyBlocks;\n }\n\n if (blocksToRun.length === 0) {\n continue;\n }\n\n const ctx = await createExecutionContext(config, filePath, coverageEnv);\n const results: TestBlockResult[] = [];\n\n try {\n for (const block of blocksToRun) {\n const result = await runBlock(block, ctx);\n\n // Skip checking for skipped tests\n if (result.skipped) {\n results.push(result);\n continue;\n }\n\n // Check if output matches expected\n // [ROOT] = test file directory, [CWD] = command working directory\n // If expectedStderr is set, compare stdout only (not combined output)\n const outputToCheck = block.expectedStderr\n ? (result.actualStdout ?? '')\n : result.actualOutput;\n const outputMatches = matchOutput(\n outputToCheck,\n block.expectedOutput,\n { root: ctx.testDir, cwd: ctx.cwd },\n config.patterns ?? {},\n );\n\n // Check stderr if expected (using actualStderr if available)\n let stderrMatches = true;\n if (block.expectedStderr) {\n stderrMatches = matchOutput(\n result.actualStderr ?? '',\n block.expectedStderr,\n { root: ctx.testDir, cwd: ctx.cwd },\n config.patterns ?? {},\n );\n }\n\n const exitCodeMatches = result.actualExitCode === block.expectedExitCode;\n result.passed = outputMatches && stderrMatches && exitCodeMatches && !result.error;\n\n if (!result.passed && opts.diff) {\n result.diff = createDiff(\n block.expectedOutput,\n result.actualOutput,\n `${filePath}:${block.lineNumber}`,\n );\n }\n\n results.push(result);\n\n if (!result.passed && opts.failFast) {\n shouldStop = true;\n break;\n }\n }\n\n // Run after hook if configured\n await runAfterHook(ctx);\n } finally {\n await cleanupExecutionContext(ctx);\n }\n\n const fileResult: TestFileResult = {\n file: testFile,\n results,\n passed: results.every((r) => r.passed),\n duration: results.reduce((sum, r) => sum + r.duration, 0),\n };\n\n fileResults.push(fileResult);\n reportFile(fileResult, opts);\n\n // Update mode\n if (opts.update && !fileResult.passed) {\n const { updated, changes } = await updateTestFile(testFile, results);\n if (updated) {\n console.error(colors.warn(` ${statusIndicators.update} Updated: ${changes.join(', ')}`));\n }\n }\n }\n\n // Summary\n const summary: TestRunSummary = {\n files: fileResults,\n totalPassed: fileResults.reduce((sum, f) => sum + f.results.filter((r) => r.passed).length, 0),\n totalFailed: fileResults.reduce((sum, f) => sum + f.results.filter((r) => !r.passed).length, 0),\n totalBlocks: fileResults.reduce((sum, f) => sum + f.results.length, 0),\n duration: Date.now() - startTime,\n };\n\n reportSummary(summary, opts);\n\n // Generate coverage report if enabled\n if (coverageCtx) {\n console.error('\\nGenerating coverage report...');\n try {\n await generateCoverageReport(coverageCtx);\n\n // Merge with external LCOV if specified\n if (coverageCtx.options.mergeLcov) {\n console.error(`Merging with external coverage: ${coverageCtx.options.mergeLcov}`);\n const merged = mergeExternalCoverage(\n coverageCtx.options.reportsDir,\n coverageCtx.options.mergeLcov,\n );\n if (merged) {\n console.error(\n colors.success(\n `Merged coverage: ${merged.lines}% lines, ${merged.functions}% functions`,\n ),\n );\n }\n }\n\n console.error(\n colors.success(`Coverage report written to ${coverageCtx.options.reportsDir}/`),\n );\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logError(`Failed to generate coverage report: ${message}`);\n } finally {\n await cleanupCoverageContext(coverageCtx);\n }\n }\n\n // Exit code\n process.exit(summary.totalFailed > 0 ? 1 : 0);\n}\n","/**\n * Coverage command - runs multiple commands with merged V8 coverage.\n *\n * This command provides a simple way to collect coverage from multiple sources\n * (e.g., unit tests + CLI tests) and generate a merged coverage report.\n *\n * Example usage:\n * tryscript coverage \"vitest run\" \"tryscript run tests/\"\n * tryscript coverage --monocart --reporters text,html \"vitest run\" \"node dist/bin.mjs run tests/\"\n */\n\nimport type { Command } from 'commander';\nimport { spawn } from 'node:child_process';\nimport { mkdtemp, rm, readdir, stat } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join, resolve } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport { logError, logWarn, colors } from '../lib/shared.js';\nimport {\n readLcovFile,\n mergeLcov,\n writeLcovFile,\n lcovToJsonSummary,\n writeJsonSummary,\n} from '../../lib/lcov.js';\n\ninterface CoverageOptions {\n reportsDir?: string;\n reporters?: string[];\n include?: string[];\n exclude?: string[];\n excludeNodeModules?: boolean;\n excludeAfterRemap?: boolean;\n skipFull?: boolean;\n allowExternal?: boolean;\n monocart?: boolean;\n src?: string;\n verbose?: boolean;\n mergeLcov?: string;\n}\n\n/**\n * Register the coverage command.\n */\nexport function registerCoverageCommand(program: Command): void {\n program\n .command('coverage')\n .description('Run commands with merged V8 coverage')\n .argument('<commands...>', 'Commands to run (each will inherit coverage environment)')\n .option('--reports-dir <dir>', 'Coverage output directory (default: coverage)')\n .option(\n '--reporters <reporters>',\n 'Comma-separated coverage reporters (default: text,json,json-summary,lcov,html)',\n )\n .option('--include <patterns>', 'Comma-separated patterns to include in coverage')\n .option('--exclude <patterns>', 'Comma-separated patterns to exclude from coverage')\n .option('--exclude-node-modules', 'Exclude node_modules from coverage (default: true)', true)\n .option('--no-exclude-node-modules', 'Include node_modules in coverage')\n .option('--exclude-after-remap', 'Apply exclude logic after sourcemap remapping')\n .option('--skip-full', 'Hide files with 100% coverage')\n .option('--allow-external', 'Allow files from outside cwd')\n .option('--monocart', 'Use monocart for accurate line counts (recommended for merging)')\n .option('--src <dir>', 'Source directory for sourcemap remapping (default: src)')\n .option('--verbose', 'Show coverage summary after each command for debugging')\n .option(\n '--merge-lcov <path>',\n 'Merge coverage from an existing LCOV file (e.g., from vitest --coverage)',\n )\n .action(coverageCommand);\n}\n\n/**\n * Run a command with inherited coverage environment.\n */\nasync function runCommand(\n command: string,\n env: Record<string, string>,\n): Promise<{ success: boolean; code: number }> {\n return new Promise((resolve) => {\n const proc = spawn(command, [], {\n stdio: 'inherit',\n env: { ...process.env, ...env },\n shell: true,\n });\n\n proc.on('close', (code) => {\n resolve({ success: code === 0, code: code ?? 1 });\n });\n\n proc.on('error', (err) => {\n logError(`Failed to run command: ${err.message}`);\n resolve({ success: false, code: 1 });\n });\n });\n}\n\n/**\n * Find the c8 executable path.\n * Can be overridden via TRYSCRIPT_C8_COMMAND env var for testing.\n */\nfunction findC8Path(): string | null {\n // Allow override for testing - when set, we trust it exists\n const override = process.env.TRYSCRIPT_C8_COMMAND;\n if (override) {\n return override;\n }\n\n const localPaths = [\n resolve(process.cwd(), 'node_modules', '.bin', 'c8'),\n resolve(process.cwd(), '..', '..', 'node_modules', '.bin', 'c8'),\n ];\n\n for (const localPath of localPaths) {\n if (existsSync(localPath)) {\n return localPath;\n }\n }\n\n return null;\n}\n\n/**\n * Get coverage file statistics from temp directory.\n */\nasync function getCoverageStats(\n tempDir: string,\n): Promise<{ fileCount: number; totalBytes: number; files: string[] }> {\n try {\n const files = await readdir(tempDir);\n const coverageFiles = files.filter((f) => f.startsWith('coverage-') && f.endsWith('.json'));\n let totalBytes = 0;\n\n for (const file of coverageFiles) {\n const fileStat = await stat(join(tempDir, file));\n totalBytes += fileStat.size;\n }\n\n return { fileCount: coverageFiles.length, totalBytes, files: coverageFiles };\n } catch {\n return { fileCount: 0, totalBytes: 0, files: [] };\n }\n}\n\n/**\n * Generate a text-only coverage report for debugging (doesn't write files).\n */\nasync function generateTextReport(\n tempDir: string,\n options: CoverageOptions,\n label: string,\n): Promise<void> {\n const c8Path = findC8Path();\n if (!c8Path) {\n return;\n }\n\n const include = options.include ?? ['dist/**'];\n const exclude = options.exclude ?? [];\n\n // Create a temporary reports dir that we'll discard\n const tempReportsDir = await mkdtemp(join(tmpdir(), 'tryscript-coverage-report-'));\n\n const reportArgs = [\n 'report',\n '--temp-directory',\n tempDir,\n '--reports-dir',\n tempReportsDir,\n '--src',\n options.src ?? 'src',\n '--all',\n ...include.flatMap((pattern) => ['--include', pattern]),\n ...exclude.flatMap((pattern) => ['--exclude', pattern]),\n ...(options.excludeNodeModules !== false\n ? ['--exclude-node-modules']\n : ['--no-exclude-node-modules']),\n ...(options.excludeAfterRemap ? ['--exclude-after-remap'] : []),\n ...(options.monocart ? ['--experimental-monocart'] : []),\n '--reporter',\n 'text',\n ];\n\n console.error(colors.info(`\\n--- Coverage after: ${label} ---`));\n\n await new Promise<void>((resolve) => {\n const proc = spawn(c8Path, reportArgs, {\n stdio: 'inherit',\n shell: false,\n });\n proc.on('close', () => {\n resolve();\n });\n proc.on('error', () => {\n resolve();\n });\n });\n\n // Cleanup temp reports dir\n await rm(tempReportsDir, { recursive: true, force: true });\n}\n\n/**\n * Generate c8 coverage report.\n */\nasync function generateReport(tempDir: string, options: CoverageOptions): Promise<boolean> {\n const c8Path = findC8Path();\n if (!c8Path) {\n logError('c8 not found. Install with: npm install -D c8');\n return false;\n }\n\n const reporters = options.reporters ?? ['text', 'json', 'json-summary', 'lcov', 'html'];\n const include = options.include ?? ['dist/**'];\n const exclude = options.exclude ?? [];\n\n const reportArgs = [\n 'report',\n '--temp-directory',\n tempDir,\n '--reports-dir',\n options.reportsDir ?? 'coverage',\n '--src',\n options.src ?? 'src',\n '--all',\n ...include.flatMap((pattern) => ['--include', pattern]),\n ...exclude.flatMap((pattern) => ['--exclude', pattern]),\n ...(options.excludeNodeModules !== false\n ? ['--exclude-node-modules']\n : ['--no-exclude-node-modules']),\n ...(options.excludeAfterRemap ? ['--exclude-after-remap'] : []),\n ...(options.skipFull ? ['--skip-full'] : []),\n ...(options.allowExternal ? ['--allowExternal'] : []),\n ...(options.monocart ? ['--experimental-monocart'] : []),\n ...reporters.flatMap((reporter) => ['--reporter', reporter]),\n ];\n\n return new Promise((resolve) => {\n const proc = spawn(c8Path, reportArgs, {\n stdio: 'inherit',\n shell: false,\n });\n\n proc.on('close', (code) => {\n resolve(code === 0);\n });\n\n proc.on('error', (err) => {\n logError(`Failed to generate coverage report: ${err.message}`);\n resolve(false);\n });\n });\n}\n\nasync function coverageCommand(commands: string[], options: CoverageOptions): Promise<void> {\n // Validate we have commands to run\n if (commands.length === 0) {\n logError('No commands specified. Usage: tryscript coverage \"cmd1\" \"cmd2\"');\n process.exit(1);\n }\n\n // Check for c8\n const c8Path = findC8Path();\n if (!c8Path) {\n logError('Coverage requires c8. Install with: npm install -D c8');\n process.exit(1);\n }\n\n // Parse comma-separated options early so we can use them for intermediate reports\n const parsedOptions: CoverageOptions = {\n ...options,\n reporters: options.reporters\n ? typeof options.reporters === 'string'\n ? (options.reporters as string).split(',')\n : options.reporters\n : undefined,\n include: options.include\n ? typeof options.include === 'string'\n ? (options.include as string).split(',')\n : options.include\n : undefined,\n exclude: options.exclude\n ? typeof options.exclude === 'string'\n ? (options.exclude as string).split(',')\n : options.exclude\n : undefined,\n };\n\n // Create temp directory for V8 coverage data\n const coverageTemp = await mkdtemp(join(tmpdir(), 'tryscript-coverage-'));\n const coverageEnv = { NODE_V8_COVERAGE: coverageTemp };\n\n console.error(colors.info(`Collecting V8 coverage to ${coverageTemp}`));\n\n let hasFailures = false;\n let previousFileCount = 0;\n\n try {\n // Run each command with shared coverage environment\n for (let i = 0; i < commands.length; i++) {\n const command = commands[i]!;\n console.error(\n colors.info(`\\n=== Running command ${i + 1}/${commands.length}: ${command} ===`),\n );\n\n const result = await runCommand(command, coverageEnv);\n if (!result.success) {\n logWarn(`Command exited with code ${result.code}: ${command}`);\n hasFailures = true;\n }\n\n // Show coverage stats after each command\n const stats = await getCoverageStats(coverageTemp);\n const newFiles = stats.fileCount - previousFileCount;\n const bytesKB = (stats.totalBytes / 1024).toFixed(1);\n\n console.error(\n colors.info(\n `\\nV8 coverage: ${stats.fileCount} files (${newFiles} new), ${bytesKB} KB total`,\n ),\n );\n\n if (newFiles === 0) {\n logWarn(\n `No new coverage files from this command. ` +\n `This may indicate the command doesn't write to NODE_V8_COVERAGE.`,\n );\n }\n\n // Show intermediate coverage report if verbose\n if (parsedOptions.verbose && stats.fileCount > 0) {\n await generateTextReport(coverageTemp, parsedOptions, command);\n }\n\n previousFileCount = stats.fileCount;\n }\n\n // Generate merged coverage report\n console.error(colors.info('\\n=== Generating coverage report ==='));\n\n const reportSuccess = await generateReport(coverageTemp, parsedOptions);\n if (!reportSuccess) {\n logError('Failed to generate coverage report');\n process.exit(1);\n }\n\n const reportsDir = parsedOptions.reportsDir ?? 'coverage';\n\n // If --merge-lcov is specified, merge with external LCOV and rewrite outputs\n if (parsedOptions.mergeLcov) {\n const externalLcovPath = parsedOptions.mergeLcov;\n const generatedLcovPath = join(reportsDir, 'lcov.info');\n\n if (!existsSync(externalLcovPath)) {\n logError(`External LCOV file not found: ${externalLcovPath}`);\n process.exit(1);\n }\n\n if (!existsSync(generatedLcovPath)) {\n logError(`Generated LCOV file not found: ${generatedLcovPath}`);\n logError('Make sure \"lcov\" is included in reporters');\n process.exit(1);\n }\n\n console.error(colors.info(`\\nMerging with external coverage: ${externalLcovPath}`));\n\n // Read and merge LCOV files\n const externalLcov = readLcovFile(externalLcovPath);\n const generatedLcov = readLcovFile(generatedLcovPath);\n const mergedLcov = mergeLcov(externalLcov, generatedLcov);\n\n // Write merged LCOV\n writeLcovFile(generatedLcovPath, mergedLcov);\n\n // Write JSON summary from merged data\n const summary = lcovToJsonSummary(mergedLcov);\n writeJsonSummary(join(reportsDir, 'coverage-summary.json'), summary);\n\n console.error(\n colors.success(\n `\\nMerged coverage: ${summary.total.lines.pct}% lines, ${summary.total.functions.pct}% functions`,\n ),\n );\n }\n\n console.error(colors.success(`\\nCoverage report written to ${reportsDir}/`));\n } finally {\n // Cleanup temp directory\n await rm(coverageTemp, { recursive: true, force: true });\n }\n\n // Exit with failure if any command failed\n if (hasFailures) {\n process.exit(1);\n }\n}\n","/**\n * Readme command - Display the README documentation.\n *\n * Shows the package README.md, formatted for the terminal when interactive,\n * or as plain text when piped.\n */\n\nimport type { Command } from 'commander';\n\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport pc from 'picocolors';\n\n/**\n * Get the path to the README.md file.\n * Works both during development and when installed as a package.\n */\nfunction getReadmePath(): string {\n const thisDir = dirname(fileURLToPath(import.meta.url));\n const dirName = thisDir.split(/[/\\\\]/).pop();\n\n if (dirName === 'dist') {\n // Bundled: dist -> package root -> README.md\n return join(dirname(thisDir), 'README.md');\n }\n\n // Development: src/cli/commands -> src/cli -> src -> package root -> README.md\n return join(dirname(dirname(dirname(thisDir))), 'README.md');\n}\n\n/**\n * Load the README content.\n */\nfunction loadReadme(): string {\n const readmePath = getReadmePath();\n try {\n return readFileSync(readmePath, 'utf-8');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to load README from ${readmePath}: ${message}`);\n }\n}\n\n/**\n * Apply basic terminal formatting to markdown content.\n * Colorizes headers, code blocks, and other elements for better readability.\n */\nfunction formatMarkdown(content: string, useColors: boolean): string {\n if (!useColors) {\n return content;\n }\n\n const lines = content.split('\\n');\n const formatted: string[] = [];\n let inCodeBlock = false;\n\n for (const line of lines) {\n // Track code blocks\n if (line.startsWith('```')) {\n inCodeBlock = !inCodeBlock;\n formatted.push(pc.dim(line));\n continue;\n }\n\n if (inCodeBlock) {\n formatted.push(pc.dim(line));\n continue;\n }\n\n // Headers\n if (line.startsWith('# ')) {\n formatted.push(pc.bold(pc.cyan(line)));\n continue;\n }\n if (line.startsWith('## ')) {\n formatted.push(pc.bold(pc.blue(line)));\n continue;\n }\n if (line.startsWith('### ')) {\n formatted.push(pc.bold(line));\n continue;\n }\n\n // Inline code (backticks)\n let formattedLine = line.replace(/`([^`]+)`/g, (_match, code: string) => {\n return pc.yellow(code);\n });\n\n // Bold text\n formattedLine = formattedLine.replace(/\\*\\*([^*]+)\\*\\*/g, (_match, text: string) => {\n return pc.bold(text);\n });\n\n // Links - show text in cyan, URL dimmed\n formattedLine = formattedLine.replace(\n /\\[([^\\]]+)\\]\\(([^)]+)\\)/g,\n (_match, text: string, url: string) => {\n return `${pc.cyan(text)} ${pc.dim(`(${url})`)}`;\n },\n );\n\n formatted.push(formattedLine);\n }\n\n return formatted.join('\\n');\n}\n\n/**\n * Check if stdout is an interactive terminal.\n */\nfunction isInteractive(): boolean {\n return process.stdout.isTTY === true;\n}\n\n/**\n * Display the README content.\n * Exported for use as the default command.\n */\nexport function showReadme(options?: { raw?: boolean; color?: boolean }): void {\n try {\n const readme = loadReadme();\n\n // Determine if we should colorize\n const shouldColorize = options?.color ?? (!options?.raw && isInteractive());\n\n const formatted = formatMarkdown(readme, shouldColorize);\n console.log(formatted);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(pc.red(`Error: ${message}`));\n process.exit(1);\n }\n}\n\n/**\n * Register the readme command.\n */\nexport function registerReadmeCommand(program: Command): void {\n program\n .command('readme')\n .description('Display README documentation')\n .option('--raw', 'Output raw markdown without formatting')\n .option('--color', 'Force colorized output (for testing)')\n .action(showReadme);\n}\n","/**\n * Docs command - Display the tryscript quick reference.\n *\n * Shows the tryscript-reference.md file, formatted for the terminal when interactive,\n * or as plain text when piped.\n */\n\nimport type { Command } from 'commander';\n\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport pc from 'picocolors';\n\n/**\n * Get the path to the tryscript-reference.md file.\n * Works both during development and when installed as a package.\n */\nfunction getDocsPath(): string {\n const thisDir = dirname(fileURLToPath(import.meta.url));\n const dirName = thisDir.split(/[/\\\\]/).pop();\n\n if (dirName === 'dist') {\n // Bundled: dist -> package root -> docs/tryscript-reference.md\n return join(dirname(thisDir), 'docs', 'tryscript-reference.md');\n }\n\n // Development: src/cli/commands -> src/cli -> src -> package root -> docs/tryscript-reference.md\n return join(dirname(dirname(dirname(thisDir))), 'docs', 'tryscript-reference.md');\n}\n\n/**\n * Load the docs content.\n */\nfunction loadDocs(): string {\n const docsPath = getDocsPath();\n try {\n return readFileSync(docsPath, 'utf-8');\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to load reference docs from ${docsPath}: ${message}`);\n }\n}\n\n/**\n * Apply basic terminal formatting to markdown content.\n * Colorizes headers, code blocks, and other elements for better readability.\n */\nfunction formatMarkdown(content: string, useColors: boolean): string {\n if (!useColors) {\n return content;\n }\n\n const lines = content.split('\\n');\n const formatted: string[] = [];\n let inCodeBlock = false;\n\n for (const line of lines) {\n // Track code blocks\n if (line.startsWith('```')) {\n inCodeBlock = !inCodeBlock;\n formatted.push(pc.dim(line));\n continue;\n }\n\n if (inCodeBlock) {\n formatted.push(pc.dim(line));\n continue;\n }\n\n // Headers\n if (line.startsWith('# ')) {\n formatted.push(pc.bold(pc.cyan(line)));\n continue;\n }\n if (line.startsWith('## ')) {\n formatted.push(pc.bold(pc.blue(line)));\n continue;\n }\n if (line.startsWith('### ')) {\n formatted.push(pc.bold(line));\n continue;\n }\n\n // Inline code (backticks)\n let formattedLine = line.replace(/`([^`]+)`/g, (_match, code: string) => {\n return pc.yellow(code);\n });\n\n // Bold text\n formattedLine = formattedLine.replace(/\\*\\*([^*]+)\\*\\*/g, (_match, text: string) => {\n return pc.bold(text);\n });\n\n // Links - show text in cyan, URL dimmed\n formattedLine = formattedLine.replace(\n /\\[([^\\]]+)\\]\\(([^)]+)\\)/g,\n (_match, text: string, url: string) => {\n return `${pc.cyan(text)} ${pc.dim(`(${url})`)}`;\n },\n );\n\n formatted.push(formattedLine);\n }\n\n return formatted.join('\\n');\n}\n\n/**\n * Check if stdout is an interactive terminal.\n */\nfunction isInteractive(): boolean {\n return process.stdout.isTTY === true;\n}\n\n/**\n * Register the docs command.\n */\nexport function registerDocsCommand(program: Command): void {\n program\n .command('docs')\n .description('Display concise syntax reference')\n .option('--raw', 'Output raw markdown without formatting')\n .option('--color', 'Force colorized output (for testing)')\n .action((options: { raw?: boolean; color?: boolean }) => {\n try {\n const docs = loadDocs();\n\n // Determine if we should colorize\n const shouldColorize = options.color ?? (!options.raw && isInteractive());\n\n const formatted = formatMarkdown(docs, shouldColorize);\n console.log(formatted);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(pc.red(`Error: ${message}`));\n process.exit(1);\n }\n });\n}\n","/**\n * CLI entry point for tryscript.\n *\n * Configures Commander.js with colored help and registers all subcommands.\n */\n\nimport { Command } from 'commander';\nimport { VERSION } from '../index.js';\nimport { registerRunCommand } from './commands/run.js';\nimport { registerCoverageCommand } from './commands/coverage.js';\nimport { registerReadmeCommand } from './commands/readme.js';\nimport { registerDocsCommand } from './commands/docs.js';\nimport { withColoredHelp, logError } from './lib/shared.js';\n\nexport function run(argv: string[]): void {\n const program = withColoredHelp(\n new Command()\n .name('tryscript')\n .version(VERSION, '--version', 'Show version number')\n .description('Golden testing for CLI applications')\n .showHelpAfterError('(use --help for usage)'),\n );\n\n // Register subcommands\n registerRunCommand(program);\n registerCoverageCommand(program);\n registerReadmeCommand(program);\n registerDocsCommand(program);\n\n // Default action: show help when no command given\n program.action(() => {\n program.help();\n });\n\n program.parseAsync(argv).catch((err: Error) => {\n logError(`Error: ${err.message}`);\n process.exit(2);\n });\n}\n","#!/usr/bin/env node\nimport { run } from './cli/cli.js';\n\nrun(process.argv);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,MAAa,SAAS;CACpB,UAAU,MAAc,GAAG,MAAM,EAAE;CACnC,QAAQ,MAAc,GAAG,IAAI,EAAE;CAC/B,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AAI,QAAQ,KAAK"}
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -156,6 +156,8 @@ declare const CoverageConfigSchema: z.ZodObject<{
|
|
|
156
156
|
src: z.ZodOptional<z.ZodString>;
|
|
157
157
|
/** Use monocart for more accurate line counts (c8 --experimental-monocart) */
|
|
158
158
|
monocart: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
/** Path to external LCOV file to merge (e.g., vitest coverage output) */
|
|
160
|
+
mergeLcov: z.ZodOptional<z.ZodString>;
|
|
159
161
|
}, "strip", z.ZodTypeAny, {
|
|
160
162
|
reportsDir?: string | undefined;
|
|
161
163
|
reporters?: string[] | undefined;
|
|
@@ -167,6 +169,7 @@ declare const CoverageConfigSchema: z.ZodObject<{
|
|
|
167
169
|
allowExternal?: boolean | undefined;
|
|
168
170
|
src?: string | undefined;
|
|
169
171
|
monocart?: boolean | undefined;
|
|
172
|
+
mergeLcov?: string | undefined;
|
|
170
173
|
}, {
|
|
171
174
|
reportsDir?: string | undefined;
|
|
172
175
|
reporters?: string[] | undefined;
|
|
@@ -178,6 +181,7 @@ declare const CoverageConfigSchema: z.ZodObject<{
|
|
|
178
181
|
allowExternal?: boolean | undefined;
|
|
179
182
|
src?: string | undefined;
|
|
180
183
|
monocart?: boolean | undefined;
|
|
184
|
+
mergeLcov?: string | undefined;
|
|
181
185
|
}>;
|
|
182
186
|
/**
|
|
183
187
|
* Coverage configuration options.
|
|
@@ -185,12 +189,15 @@ declare const CoverageConfigSchema: z.ZodObject<{
|
|
|
185
189
|
type CoverageConfig = z.infer<typeof CoverageConfigSchema>;
|
|
186
190
|
/**
|
|
187
191
|
* Runtime context for coverage collection during test execution.
|
|
192
|
+
* Note: options type is defined in config.ts as ResolvedCoverageConfig
|
|
188
193
|
*/
|
|
189
194
|
interface CoverageContext {
|
|
190
195
|
/** Temporary directory for V8 coverage data files */
|
|
191
196
|
tempDir: string;
|
|
192
197
|
/** Resolved coverage options with defaults applied */
|
|
193
|
-
options: Required<CoverageConfig
|
|
198
|
+
options: Omit<Required<CoverageConfig>, 'mergeLcov'> & {
|
|
199
|
+
mergeLcov?: string;
|
|
200
|
+
};
|
|
194
201
|
}
|
|
195
202
|
//#endregion
|
|
196
203
|
//#region src/lib/config.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -156,6 +156,8 @@ declare const CoverageConfigSchema: z.ZodObject<{
|
|
|
156
156
|
src: z.ZodOptional<z.ZodString>;
|
|
157
157
|
/** Use monocart for more accurate line counts (c8 --experimental-monocart) */
|
|
158
158
|
monocart: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
/** Path to external LCOV file to merge (e.g., vitest coverage output) */
|
|
160
|
+
mergeLcov: z.ZodOptional<z.ZodString>;
|
|
159
161
|
}, "strip", z.ZodTypeAny, {
|
|
160
162
|
reportsDir?: string | undefined;
|
|
161
163
|
reporters?: string[] | undefined;
|
|
@@ -167,6 +169,7 @@ declare const CoverageConfigSchema: z.ZodObject<{
|
|
|
167
169
|
allowExternal?: boolean | undefined;
|
|
168
170
|
src?: string | undefined;
|
|
169
171
|
monocart?: boolean | undefined;
|
|
172
|
+
mergeLcov?: string | undefined;
|
|
170
173
|
}, {
|
|
171
174
|
reportsDir?: string | undefined;
|
|
172
175
|
reporters?: string[] | undefined;
|
|
@@ -178,6 +181,7 @@ declare const CoverageConfigSchema: z.ZodObject<{
|
|
|
178
181
|
allowExternal?: boolean | undefined;
|
|
179
182
|
src?: string | undefined;
|
|
180
183
|
monocart?: boolean | undefined;
|
|
184
|
+
mergeLcov?: string | undefined;
|
|
181
185
|
}>;
|
|
182
186
|
/**
|
|
183
187
|
* Coverage configuration options.
|
|
@@ -185,12 +189,15 @@ declare const CoverageConfigSchema: z.ZodObject<{
|
|
|
185
189
|
type CoverageConfig = z.infer<typeof CoverageConfigSchema>;
|
|
186
190
|
/**
|
|
187
191
|
* Runtime context for coverage collection during test execution.
|
|
192
|
+
* Note: options type is defined in config.ts as ResolvedCoverageConfig
|
|
188
193
|
*/
|
|
189
194
|
interface CoverageContext {
|
|
190
195
|
/** Temporary directory for V8 coverage data files */
|
|
191
196
|
tempDir: string;
|
|
192
197
|
/** Resolved coverage options with defaults applied */
|
|
193
|
-
options: Required<CoverageConfig
|
|
198
|
+
options: Omit<Required<CoverageConfig>, 'mergeLcov'> & {
|
|
199
|
+
mergeLcov?: string;
|
|
200
|
+
};
|
|
194
201
|
}
|
|
195
202
|
//#endregion
|
|
196
203
|
//#region src/lib/config.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as createExecutionContext, c as parseTestFile, i as cleanupExecutionContext, l as defineConfig, n as matchOutput, r as normalizeOutput, s as runBlock, t as VERSION } from "./src-
|
|
2
|
+
import { a as createExecutionContext, c as parseTestFile, i as cleanupExecutionContext, l as defineConfig, n as matchOutput, r as normalizeOutput, s as runBlock, t as VERSION } from "./src-D60Uy8QA.mjs";
|
|
3
3
|
|
|
4
4
|
export { VERSION, cleanupExecutionContext, createExecutionContext, defineConfig, matchOutput, normalizeOutput, parseTestFile, runBlock };
|
|
@@ -66,7 +66,8 @@ function resolveCoverageConfig(config) {
|
|
|
66
66
|
skipFull: config?.skipFull ?? DEFAULT_COVERAGE_CONFIG.skipFull,
|
|
67
67
|
allowExternal: config?.allowExternal ?? DEFAULT_COVERAGE_CONFIG.allowExternal,
|
|
68
68
|
src: config?.src ?? DEFAULT_COVERAGE_CONFIG.src,
|
|
69
|
-
monocart: config?.monocart ?? DEFAULT_COVERAGE_CONFIG.monocart
|
|
69
|
+
monocart: config?.monocart ?? DEFAULT_COVERAGE_CONFIG.monocart,
|
|
70
|
+
mergeLcov: config?.mergeLcov
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
73
|
const CONFIG_FILES = [
|
|
@@ -480,7 +481,7 @@ function matchOutput(actual, expected, context, customPatterns = {}) {
|
|
|
480
481
|
|
|
481
482
|
//#endregion
|
|
482
483
|
//#region src/index.ts
|
|
483
|
-
const VERSION = "0.1.
|
|
484
|
+
const VERSION = "0.1.4";
|
|
484
485
|
|
|
485
486
|
//#endregion
|
|
486
487
|
Object.defineProperty(exports, 'VERSION', {
|
|
@@ -561,4 +562,4 @@ Object.defineProperty(exports, 'runBlock', {
|
|
|
561
562
|
return runBlock;
|
|
562
563
|
}
|
|
563
564
|
});
|
|
564
|
-
//# sourceMappingURL=src-
|
|
565
|
+
//# sourceMappingURL=src-BGWMAShO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-BGWMAShO.cjs","names":["DEFAULT_COVERAGE_CONFIG: ResolvedCoverageConfig","module","config: TestConfig","blocks: TestBlock[]","match: RegExpExecArray | null","commandLines: string[]","outputLines: string[]","stderrLines: string[]","expectedStderr: string | undefined","cwd: string","combinedChunks: { data: Buffer; type: 'stdout' | 'stderr' }[]","stdoutChunks: Buffer[]","stderrChunks: Buffer[]","VERSION: string"],"sources":["../src/lib/config.ts","../src/lib/parser.ts","../src/lib/runner.ts","../src/lib/matcher.ts","../src/index.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport { existsSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type { TestConfig, CoverageConfig } from './types.js';\n\n/** Fixture configuration for copying files to sandbox directory */\nexport interface Fixture {\n /** Source path (resolved relative to test file) */\n source: string;\n /** Destination path (resolved relative to sandbox dir) */\n dest?: string;\n}\n\nexport interface TryscriptConfig {\n /** Working directory for commands (default: test file directory) */\n cwd?: string;\n /** Run in isolated sandbox: true = empty temp, path = copy to temp */\n sandbox?: boolean | string;\n /** Fixtures to copy to sandbox directory before tests */\n fixtures?: (string | Fixture)[];\n /** Script to run before first test block */\n before?: string;\n /** Script to run after all test blocks */\n after?: string;\n env?: Record<string, string>;\n timeout?: number;\n patterns?: Record<string, RegExp | string>;\n tests?: string[];\n /** Coverage configuration (used with --coverage flag) */\n coverage?: CoverageConfig;\n}\n\n/** Resolved coverage config with required fields (except optional mergeLcov) */\nexport type ResolvedCoverageConfig = Omit<Required<CoverageConfig>, 'mergeLcov'> & {\n mergeLcov?: string;\n};\n\n/** Default coverage configuration values. */\nexport const DEFAULT_COVERAGE_CONFIG: ResolvedCoverageConfig = {\n reportsDir: 'coverage-tryscript',\n reporters: ['text', 'html'],\n include: ['dist/**'],\n exclude: [],\n excludeNodeModules: true,\n excludeAfterRemap: false,\n skipFull: false,\n allowExternal: false,\n src: 'src',\n monocart: false,\n};\n\n/**\n * Resolve coverage options by merging user config with defaults.\n */\nexport function resolveCoverageConfig(config?: CoverageConfig): ResolvedCoverageConfig {\n return {\n reportsDir: config?.reportsDir ?? DEFAULT_COVERAGE_CONFIG.reportsDir,\n reporters: config?.reporters ?? DEFAULT_COVERAGE_CONFIG.reporters,\n include: config?.include ?? DEFAULT_COVERAGE_CONFIG.include,\n exclude: config?.exclude ?? DEFAULT_COVERAGE_CONFIG.exclude,\n excludeNodeModules: config?.excludeNodeModules ?? DEFAULT_COVERAGE_CONFIG.excludeNodeModules,\n excludeAfterRemap: config?.excludeAfterRemap ?? DEFAULT_COVERAGE_CONFIG.excludeAfterRemap,\n skipFull: config?.skipFull ?? DEFAULT_COVERAGE_CONFIG.skipFull,\n allowExternal: config?.allowExternal ?? DEFAULT_COVERAGE_CONFIG.allowExternal,\n src: config?.src ?? DEFAULT_COVERAGE_CONFIG.src,\n monocart: config?.monocart ?? DEFAULT_COVERAGE_CONFIG.monocart,\n mergeLcov: config?.mergeLcov,\n };\n}\n\nconst CONFIG_FILES = ['tryscript.config.ts', 'tryscript.config.js', 'tryscript.config.mjs'];\n\n/**\n * Load config file using dynamic import.\n * Supports both TypeScript (via tsx/ts-node) and JavaScript configs.\n */\nexport async function loadConfig(baseDir: string): Promise<TryscriptConfig> {\n for (const filename of CONFIG_FILES) {\n const configPath = resolve(baseDir, filename);\n if (existsSync(configPath)) {\n const configUrl = pathToFileURL(configPath).href;\n const module = (await import(configUrl)) as { default?: TryscriptConfig } | TryscriptConfig;\n return (module as { default?: TryscriptConfig }).default ?? (module as TryscriptConfig);\n }\n }\n return {};\n}\n\n/**\n * Merge config with frontmatter overrides.\n * Frontmatter takes precedence over config file.\n */\nexport function mergeConfig(base: TryscriptConfig, frontmatter: TestConfig): TryscriptConfig {\n return {\n ...base,\n ...frontmatter,\n env: { ...base.env, ...frontmatter.env },\n patterns: { ...base.patterns, ...frontmatter.patterns },\n fixtures: [...(base.fixtures ?? []), ...(frontmatter.fixtures ?? [])],\n };\n}\n\n/**\n * Helper for typed config files.\n */\nexport function defineConfig(config: TryscriptConfig): TryscriptConfig {\n return config;\n}\n","import { parse as parseYaml } from 'yaml';\nimport type { TestConfig, TestBlock, TestFile } from './types.js';\n\n/** Regex to match YAML frontmatter at the start of a file */\nconst FRONTMATTER_REGEX = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---\\r?\\n/;\n\n/** Regex to match fenced code blocks with console/bash info string */\nconst CODE_BLOCK_REGEX = /```(console|bash)\\r?\\n([\\s\\S]*?)```/g;\n\n/** Regex to match markdown headings (for test names) */\nconst HEADING_REGEX = /^#+\\s+(?:Test:\\s*)?(.+)$/m;\n\n/** Regex to match skip annotation in heading or nearby HTML comment */\nconst SKIP_ANNOTATION_REGEX = /<!--\\s*skip\\s*-->/i;\n\n/** Regex to match only annotation in heading or nearby HTML comment */\nconst ONLY_ANNOTATION_REGEX = /<!--\\s*only\\s*-->/i;\n\n/**\n * Parse a .tryscript.md file into structured test data.\n */\nexport function parseTestFile(content: string, filePath: string): TestFile {\n const rawContent = content;\n let config: TestConfig = {};\n let body = content;\n\n // Extract frontmatter if present\n const frontmatterMatch = FRONTMATTER_REGEX.exec(content);\n if (frontmatterMatch) {\n const yamlContent = frontmatterMatch[1] ?? '';\n config = parseYaml(yamlContent) as TestConfig;\n body = content.slice(frontmatterMatch[0].length);\n }\n\n // Parse all console blocks\n const blocks: TestBlock[] = [];\n\n // Reset regex lastIndex\n CODE_BLOCK_REGEX.lastIndex = 0;\n\n let match: RegExpExecArray | null;\n while ((match = CODE_BLOCK_REGEX.exec(body)) !== null) {\n const blockContent = match[2] ?? '';\n const blockStart = match.index;\n\n // Find the line number (1-indexed)\n const precedingContent = content.slice(0, content.indexOf(match[0]));\n const lineNumber = precedingContent.split('\\n').length;\n\n // Look for a heading before this block (for test name)\n const contentBefore = body.slice(0, blockStart);\n const lastHeadingMatch = [\n ...contentBefore.matchAll(new RegExp(HEADING_REGEX.source, 'gm')),\n ].pop();\n const name = lastHeadingMatch?.[1]?.trim();\n\n // Check for skip/only annotations in the heading line or nearby comments\n const headingContext = lastHeadingMatch\n ? contentBefore.slice(contentBefore.lastIndexOf(lastHeadingMatch[0]))\n : '';\n const skip = SKIP_ANNOTATION_REGEX.test(headingContext);\n const only = ONLY_ANNOTATION_REGEX.test(headingContext);\n\n // Parse the block content\n const parsed = parseBlockContent(blockContent);\n if (parsed) {\n blocks.push({\n name,\n command: parsed.command,\n expectedOutput: parsed.expectedOutput,\n expectedStderr: parsed.expectedStderr,\n expectedExitCode: parsed.expectedExitCode,\n lineNumber,\n rawContent: match[0],\n skip,\n only,\n });\n }\n }\n\n return { path: filePath, config, blocks, rawContent };\n}\n\n/**\n * Parse the content of a single console block.\n */\nfunction parseBlockContent(content: string): {\n command: string;\n expectedOutput: string;\n expectedStderr?: string;\n expectedExitCode: number;\n} | null {\n const lines = content.split('\\n');\n const commandLines: string[] = [];\n const outputLines: string[] = [];\n const stderrLines: string[] = [];\n let expectedExitCode = 0;\n let inCommand = false;\n\n for (const line of lines) {\n if (line.startsWith('$ ')) {\n // Start of a command\n inCommand = true;\n commandLines.push(line.slice(2));\n } else if (line.startsWith('> ') && inCommand) {\n // Continuation of a multi-line command\n commandLines.push(line.slice(2));\n } else if (line.startsWith('? ')) {\n // Exit code specification\n inCommand = false;\n expectedExitCode = parseInt(line.slice(2).trim(), 10);\n } else if (line.startsWith('! ')) {\n // Stderr line (prefixed with !)\n inCommand = false;\n stderrLines.push(line.slice(2));\n } else {\n // Output line (stdout or combined)\n inCommand = false;\n outputLines.push(line);\n }\n }\n\n if (commandLines.length === 0) {\n return null;\n }\n\n // Join command lines, handling shell continuations\n let command = '';\n for (let i = 0; i < commandLines.length; i++) {\n const line = commandLines[i] ?? '';\n if (line.endsWith('\\\\')) {\n command += line.slice(0, -1) + ' ';\n } else {\n command += line;\n if (i < commandLines.length - 1) {\n command += ' ';\n }\n }\n }\n\n // Join output lines, preserving blank lines but trimming trailing empty lines\n let expectedOutput = outputLines.join('\\n');\n expectedOutput = expectedOutput.replace(/\\n+$/, '');\n if (expectedOutput) {\n expectedOutput += '\\n';\n }\n\n // Join stderr lines if any\n let expectedStderr: string | undefined;\n if (stderrLines.length > 0) {\n expectedStderr = stderrLines.join('\\n');\n expectedStderr = expectedStderr.replace(/\\n+$/, '');\n if (expectedStderr) {\n expectedStderr += '\\n';\n }\n }\n\n return { command: command.trim(), expectedOutput, expectedStderr, expectedExitCode };\n}\n","import { spawn } from 'node:child_process';\nimport { mkdtemp, realpath, rm, cp } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join, dirname, resolve, basename } from 'node:path';\nimport treeKill from 'tree-kill';\nimport type { TestBlock, TestBlockResult } from './types.js';\nimport type { TryscriptConfig, Fixture } from './config.js';\n\n/** Default timeout in milliseconds */\nconst DEFAULT_TIMEOUT = 30_000;\n\n/**\n * Execution context for a test file.\n * Created once per file, contains directory paths and config.\n */\nexport interface ExecutionContext {\n /** Temporary directory for this test file (resolved, no symlinks) */\n tempDir: string;\n /** Directory containing the test file */\n testDir: string;\n /** Working directory for command execution */\n cwd: string;\n /** Whether running in sandbox mode */\n sandbox: boolean;\n /** Environment variables */\n env: Record<string, string>;\n /** Timeout per command */\n timeout: number;\n /** Before hook script */\n before?: string;\n /** After hook script */\n after?: string;\n /** Whether before hook has been run */\n beforeRan?: boolean;\n}\n\n/**\n * Normalize fixture config to Fixture object.\n */\nfunction normalizeFixture(fixture: string | Fixture): Fixture {\n if (typeof fixture === 'string') {\n return { source: fixture };\n }\n return fixture;\n}\n\n/**\n * Setup fixtures by copying files to sandbox directory.\n */\nasync function setupFixtures(\n fixtures: (string | Fixture)[] | undefined,\n testDir: string,\n sandboxDir: string,\n): Promise<void> {\n if (!fixtures || fixtures.length === 0) {\n return;\n }\n\n for (const f of fixtures) {\n const fixture = normalizeFixture(f);\n const src = resolve(testDir, fixture.source);\n const destName = fixture.dest ?? basename(fixture.source);\n const dst = resolve(sandboxDir, destName);\n await cp(src, dst, { recursive: true });\n }\n}\n\n/**\n * Create an execution context for a test file.\n * @param config - Test configuration\n * @param testFilePath - Path to the test file\n * @param coverageEnv - Optional coverage environment variables (e.g., NODE_V8_COVERAGE)\n */\nexport async function createExecutionContext(\n config: TryscriptConfig,\n testFilePath: string,\n coverageEnv?: Record<string, string>,\n): Promise<ExecutionContext> {\n // Create temp directory and resolve symlinks (e.g., /var -> /private/var on macOS)\n // This ensures [CWD] and [ROOT] patterns match pwd output\n const rawTempDir = await mkdtemp(join(tmpdir(), 'tryscript-'));\n const tempDir = await realpath(rawTempDir);\n\n // Resolve test file directory for portable test commands\n const testDir = resolve(dirname(testFilePath));\n\n // Determine working directory based on sandbox config\n let cwd: string;\n let sandbox = false;\n\n if (config.sandbox === true) {\n // Empty sandbox: run in temp directory\n cwd = tempDir;\n sandbox = true;\n } else if (typeof config.sandbox === 'string') {\n // Copy directory to sandbox: copy source to temp, run in temp\n const srcPath = resolve(testDir, config.sandbox);\n await cp(srcPath, tempDir, { recursive: true });\n cwd = tempDir;\n sandbox = true;\n } else if (config.cwd) {\n // Run in specified directory (relative to test file)\n cwd = resolve(testDir, config.cwd);\n } else {\n // Default: run in test file directory\n cwd = testDir;\n }\n\n // Copy additional fixtures to sandbox (only if sandbox enabled)\n if (sandbox && config.fixtures) {\n await setupFixtures(config.fixtures, testDir, tempDir);\n }\n\n const ctx: ExecutionContext = {\n tempDir,\n testDir,\n cwd,\n sandbox,\n env: {\n ...process.env,\n ...config.env,\n ...coverageEnv,\n // Disable colors by default for deterministic output\n NO_COLOR: config.env?.NO_COLOR ?? '1',\n FORCE_COLOR: '0',\n // Provide test directory for portable test commands\n TRYSCRIPT_TEST_DIR: testDir,\n } as Record<string, string>,\n timeout: config.timeout ?? DEFAULT_TIMEOUT,\n before: config.before,\n after: config.after,\n };\n\n return ctx;\n}\n\n/**\n * Clean up execution context (remove temp directory).\n */\nexport async function cleanupExecutionContext(ctx: ExecutionContext): Promise<void> {\n await rm(ctx.tempDir, { recursive: true, force: true });\n}\n\n/**\n * Run the before hook if it hasn't run yet.\n */\nexport async function runBeforeHook(ctx: ExecutionContext): Promise<void> {\n if (ctx.before && !ctx.beforeRan) {\n ctx.beforeRan = true;\n await executeCommand(ctx.before, ctx);\n }\n}\n\n/**\n * Run the after hook.\n */\nexport async function runAfterHook(ctx: ExecutionContext): Promise<void> {\n if (ctx.after) {\n await executeCommand(ctx.after, ctx);\n }\n}\n\n/**\n * Run a single test block and return the result.\n */\nexport async function runBlock(block: TestBlock, ctx: ExecutionContext): Promise<TestBlockResult> {\n const startTime = Date.now();\n\n // Handle skip annotation\n if (block.skip) {\n return {\n block,\n passed: true,\n actualOutput: '',\n actualExitCode: 0,\n duration: 0,\n skipped: true,\n };\n }\n\n try {\n // Run before hook if this is the first test\n await runBeforeHook(ctx);\n\n // Execute command directly (shell handles $VAR expansion)\n const { output, stdout, stderr, exitCode } = await executeCommand(block.command, ctx);\n\n const duration = Date.now() - startTime;\n\n return {\n block,\n passed: true, // Matching handled separately\n actualOutput: output,\n actualStdout: stdout,\n actualStderr: stderr,\n actualExitCode: exitCode,\n duration,\n };\n } catch (error) {\n const duration = Date.now() - startTime;\n const message = error instanceof Error ? error.message : String(error);\n\n return {\n block,\n passed: false,\n actualOutput: '',\n actualExitCode: -1,\n duration,\n error: message,\n };\n }\n}\n\n/** Command execution result with separate stdout/stderr */\ninterface CommandResult {\n output: string;\n stdout: string;\n stderr: string;\n exitCode: number;\n}\n\n/**\n * Execute a command and capture output.\n */\nasync function executeCommand(command: string, ctx: ExecutionContext): Promise<CommandResult> {\n return new Promise((resolve, reject) => {\n const proc = spawn(command, {\n shell: true,\n cwd: ctx.cwd,\n env: ctx.env as NodeJS.ProcessEnv,\n // Pipe both to capture\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n const combinedChunks: { data: Buffer; type: 'stdout' | 'stderr' }[] = [];\n const stdoutChunks: Buffer[] = [];\n const stderrChunks: Buffer[] = [];\n\n // Capture data as it comes in to preserve order\n proc.stdout.on('data', (data: Buffer) => {\n combinedChunks.push({ data, type: 'stdout' });\n stdoutChunks.push(data);\n });\n proc.stderr.on('data', (data: Buffer) => {\n combinedChunks.push({ data, type: 'stderr' });\n stderrChunks.push(data);\n });\n\n const timeoutId = setTimeout(() => {\n if (proc.pid) {\n treeKill(proc.pid, 'SIGKILL');\n }\n reject(new Error(`Command timed out after ${ctx.timeout}ms`));\n }, ctx.timeout);\n\n proc.on('close', (code) => {\n clearTimeout(timeoutId);\n const output = Buffer.concat(combinedChunks.map((c) => c.data)).toString('utf-8');\n const stdout = Buffer.concat(stdoutChunks).toString('utf-8');\n const stderr = Buffer.concat(stderrChunks).toString('utf-8');\n resolve({\n output,\n stdout,\n stderr,\n exitCode: code ?? 0,\n });\n });\n\n proc.on('error', (err) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n });\n}\n","import stripAnsi from 'strip-ansi';\n\n/**\n * Escape special regex characters in a string.\n */\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n// Marker prefix for patterns (uses Unicode private use chars that won't appear in normal output)\nconst MARKER = '\\uE000';\n\n/**\n * Convert expected output with elision patterns to a regex.\n *\n * Handles (matching trycmd):\n * - [..] — matches any characters on the same line (trycmd: [^\\n]*?)\n * - ... — matches zero or more complete lines (trycmd: \\n(([^\\n]*\\n)*)?)\n * - [EXE] — matches .exe on Windows, empty otherwise\n * - [ROOT] — replaced with test root directory (pre-processed)\n * - [CWD] — replaced with current working directory (pre-processed)\n * - Custom [NAME] patterns from config (trycmd: TestCases::insert_var)\n */\nfunction patternToRegex(\n expected: string,\n customPatterns: Record<string, string | RegExp> = {},\n): RegExp {\n // Build a map of markers to their regex replacements\n const replacements = new Map<string, string>();\n let markerIndex = 0;\n\n const getMarker = (): string => {\n return `${MARKER}${markerIndex++}${MARKER}`;\n };\n\n let processed = expected;\n\n // Replace [..] with marker\n const dotdotMarker = getMarker();\n replacements.set(dotdotMarker, '[^\\\\n]*');\n processed = processed.replaceAll('[..]', dotdotMarker);\n\n // Replace ... (followed by newline) with marker\n const ellipsisMarker = getMarker();\n replacements.set(ellipsisMarker, '(?:[^\\\\n]*\\\\n)*');\n processed = processed.replace(/\\.\\.\\.\\n/g, ellipsisMarker);\n\n // Replace [EXE] with marker\n const exeMarker = getMarker();\n const exe = process.platform === 'win32' ? '\\\\.exe' : '';\n replacements.set(exeMarker, exe);\n processed = processed.replaceAll('[EXE]', exeMarker);\n\n // Replace custom patterns with markers\n for (const [name, pattern] of Object.entries(customPatterns)) {\n const placeholder = `[${name}]`;\n const patternStr = pattern instanceof RegExp ? pattern.source : pattern;\n const marker = getMarker();\n replacements.set(marker, `(${patternStr})`);\n processed = processed.replaceAll(placeholder, marker);\n }\n\n // Escape special regex characters\n let regex = escapeRegex(processed);\n\n // Restore markers to their regex replacements\n for (const [marker, replacement] of replacements) {\n regex = regex.replaceAll(escapeRegex(marker), replacement);\n }\n\n // Match the entire string (dotall mode for . to match newlines if needed)\n return new RegExp(`^${regex}$`, 's');\n}\n\n/**\n * Pre-process expected output to replace path placeholders with actual paths.\n * This happens BEFORE pattern matching.\n */\nfunction preprocessPaths(expected: string, context: { root: string; cwd: string }): string {\n let result = expected;\n // Normalize paths for comparison (use forward slashes)\n const normalizedRoot = context.root.replace(/\\\\/g, '/');\n const normalizedCwd = context.cwd.replace(/\\\\/g, '/');\n result = result.replaceAll('[ROOT]', normalizedRoot);\n result = result.replaceAll('[CWD]', normalizedCwd);\n return result;\n}\n\n/**\n * Normalize actual output for comparison.\n * - Remove ANSI escape codes (colors, etc.)\n * - Normalize line endings to \\n\n * - Normalize paths (Windows backslashes to forward slashes)\n * - Trim trailing whitespace from lines\n * - Ensure single trailing newline\n */\nexport function normalizeOutput(output: string): string {\n // Remove ANSI escape codes first\n let normalized = stripAnsi(output);\n\n normalized = normalized\n .replace(/\\r\\n/g, '\\n')\n .replace(/\\r/g, '\\n')\n .split('\\n')\n .map((line) => line.trimEnd())\n .join('\\n')\n .replace(/\\n+$/, '\\n');\n\n // Handle empty output\n if (normalized === '\\n') {\n normalized = '';\n }\n\n return normalized;\n}\n\n/**\n * Check if actual output matches expected pattern.\n */\nexport function matchOutput(\n actual: string,\n expected: string,\n context: { root: string; cwd: string },\n customPatterns: Record<string, string | RegExp> = {},\n): boolean {\n const normalizedActual = normalizeOutput(actual);\n const normalizedExpected = normalizeOutput(expected);\n\n // Empty expected matches empty actual\n if (normalizedExpected === '' && normalizedActual === '') {\n return true;\n }\n\n const preprocessed = preprocessPaths(normalizedExpected, context);\n const regex = patternToRegex(preprocessed, customPatterns);\n return regex.test(normalizedActual);\n}\n","// Public API exports\n\n// Version constant (injected at build time)\ndeclare const __VERSION__: string;\nexport const VERSION: string = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'development';\n\n// Config helper\nexport { defineConfig } from './lib/config.js';\nexport type { TryscriptConfig } from './lib/config.js';\n\n// Types\nexport type {\n TestConfig,\n TestBlock,\n TestFile,\n TestBlockResult,\n TestFileResult,\n TestRunSummary,\n CoverageConfig,\n CoverageContext,\n} from './lib/types.js';\n\n// Core functions (for programmatic use)\nexport { parseTestFile } from './lib/parser.js';\nexport { runBlock, createExecutionContext, cleanupExecutionContext } from './lib/runner.js';\nexport type { ExecutionContext } from './lib/runner.js';\nexport { matchOutput, normalizeOutput } from './lib/matcher.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAaA,0BAAkD;CAC7D,YAAY;CACZ,WAAW,CAAC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AAY,UAAU;AAGlC,MAAK,MAAM,CAAC,QAAQ,gBAAgB,aAClC,SAAQ,MAAM,WAAW,YAAY,OAAO,EAAE,YAAY;AAI5D,QAAO,IAAI,OAAO,IAAI,MAAM,IAAI,IAAI;;;;;;AAOtC,SAAS,gBAAgB,UAAkB,SAAgD;CACzF,IAAI,SAAS;CAEb,MAAM,iBAAiB,QAAQ,KAAK,QAAQ,OAAO,IAAI;CACvD,MAAM,gBAAgB,QAAQ,IAAI,QAAQ,OAAO,IAAI;AACrD,UAAS,OAAO,WAAW,UAAU,eAAe;AACpD,UAAS,OAAO,WAAW,SAAS,cAAc;AAClD,QAAO;;;;;;;;;;AAWT,SAAgB,gBAAgB,QAAwB;CAEtD,IAAI,qCAAuB,OAAO;AAElC,cAAa,WACV,QAAQ,SAAS,KAAK,CACtB,QAAQ,OAAO,KAAK,CACpB,MAAM,KAAK,CACX,KAAK,SAAS,KAAK,SAAS,CAAC,CAC7B,KAAK,KAAK,CACV,QAAQ,QAAQ,KAAK;AAGxB,KAAI,eAAe,KACjB,cAAa;AAGf,QAAO;;;;;AAMT,SAAgB,YACd,QACA,UACA,SACA,iBAAkD,EAAE,EAC3C;CACT,MAAM,mBAAmB,gBAAgB,OAAO;CAChD,MAAM,qBAAqB,gBAAgB,SAAS;AAGpD,KAAI,uBAAuB,MAAM,qBAAqB,GACpD,QAAO;AAKT,QADc,eADO,gBAAgB,oBAAoB,QAAQ,EACtB,eAAe,CAC7C,KAAK,iBAAiB;;;;;ACnIrC,MAAaC"}
|
|
@@ -37,7 +37,8 @@ function resolveCoverageConfig(config) {
|
|
|
37
37
|
skipFull: config?.skipFull ?? DEFAULT_COVERAGE_CONFIG.skipFull,
|
|
38
38
|
allowExternal: config?.allowExternal ?? DEFAULT_COVERAGE_CONFIG.allowExternal,
|
|
39
39
|
src: config?.src ?? DEFAULT_COVERAGE_CONFIG.src,
|
|
40
|
-
monocart: config?.monocart ?? DEFAULT_COVERAGE_CONFIG.monocart
|
|
40
|
+
monocart: config?.monocart ?? DEFAULT_COVERAGE_CONFIG.monocart,
|
|
41
|
+
mergeLcov: config?.mergeLcov
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
const CONFIG_FILES = [
|
|
@@ -451,8 +452,8 @@ function matchOutput(actual, expected, context, customPatterns = {}) {
|
|
|
451
452
|
|
|
452
453
|
//#endregion
|
|
453
454
|
//#region src/index.ts
|
|
454
|
-
const VERSION = "0.1.
|
|
455
|
+
const VERSION = "0.1.4";
|
|
455
456
|
|
|
456
457
|
//#endregion
|
|
457
458
|
export { createExecutionContext as a, parseTestFile as c, mergeConfig as d, resolveCoverageConfig as f, cleanupExecutionContext as i, defineConfig as l, matchOutput as n, runAfterHook as o, normalizeOutput as r, runBlock as s, VERSION as t, loadConfig as u };
|
|
458
|
-
//# sourceMappingURL=src-
|
|
459
|
+
//# sourceMappingURL=src-D60Uy8QA.mjs.map
|