docs: update CLAUDE.md and minor cleanup
This commit is contained in:
parent
5d2a4618d9
commit
945925fd99
|
|
@ -23,6 +23,7 @@ Transcript-based shell integration test runner. Bun + TypeScript.
|
||||||
- `src/match.ts` — wildcard-aware output matching and diff generation
|
- `src/match.ts` — wildcard-aware output matching and diff generation
|
||||||
- `src/format.ts` — evaluates pass/fail, formats failures and summary
|
- `src/format.ts` — evaluates pass/fail, formats failures and summary
|
||||||
- `src/update.ts` — rewrites `.shout` files with actual output (`--update` mode)
|
- `src/update.ts` — rewrites `.shout` files with actual output (`--update` mode)
|
||||||
|
- `src/utils.ts` — shared utilities (`trimTrailingEmpty`, `escapeRegex`)
|
||||||
- `src/duration.ts` — parses duration strings (`10s`, `500ms`, `1m`)
|
- `src/duration.ts` — parses duration strings (`10s`, `500ms`, `1m`)
|
||||||
- `src/cli/index.ts` — CLI entry point via `commander`
|
- `src/cli/index.ts` — CLI entry point via `commander`
|
||||||
- `src/index.ts` — barrel exports
|
- `src/index.ts` — barrel exports
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"check": "bunx tsc --noEmit",
|
"check": "bunx tsc --noEmit",
|
||||||
"cli:install": "bun cli:build && sudo cp dist/shout /usr/local/bin",
|
|
||||||
"cli:link": "ln -sf $(pwd)/src/cli/index.ts ~/.bun/bin/shout",
|
"cli:link": "ln -sf $(pwd)/src/cli/index.ts ~/.bun/bin/shout",
|
||||||
"cli:uninstall": "sudo rm /usr/local/bin",
|
|
||||||
"test": "bun test"
|
"test": "bun test"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,12 @@ export function parseDuration(s: string): number {
|
||||||
if (!match) throw new Error(`Invalid duration: ${s}`)
|
if (!match) throw new Error(`Invalid duration: ${s}`)
|
||||||
|
|
||||||
const value = parseFloat(match[1]!)
|
const value = parseFloat(match[1]!)
|
||||||
const unit = match[2] as "ms" | "s" | "m"
|
const unit = match[2]!
|
||||||
|
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case "ms": return value
|
case "ms": return value
|
||||||
case "s": return value * 1000
|
case "s": return value * 1000
|
||||||
case "m": return value * 60_000
|
case "m": return value * 60_000
|
||||||
|
default: throw new Error(`Unknown unit: ${unit}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export type { Command, ShoutFile } from "./parse.ts"
|
export type { Command, Directive, ShoutFile } from "./parse.ts"
|
||||||
export type { CommandResult, FileResult } from "./run.ts"
|
export type { CommandResult, FileResult } from "./run.ts"
|
||||||
export type { DiffLine } from "./match.ts"
|
export type { DiffLine } from "./match.ts"
|
||||||
export type { TestResult } from "./format.ts"
|
export type { TestResult } from "./format.ts"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { tmpdir } from "node:os"
|
||||||
import { join } from "node:path"
|
import { join } from "node:path"
|
||||||
|
|
||||||
import type { Command, ShoutFile } from "./parse.ts"
|
import type { Command, ShoutFile } from "./parse.ts"
|
||||||
import { trimTrailingEmpty, escapeRegex } from "./utils.ts"
|
import { trimTrailingEmpty } from "./utils.ts"
|
||||||
|
|
||||||
export type CommandResult = {
|
export type CommandResult = {
|
||||||
command: Command
|
command: Command
|
||||||
|
|
@ -46,7 +46,6 @@ function buildScript(commands: Command[]): string {
|
||||||
|
|
||||||
function parseSentinelOutput(
|
function parseSentinelOutput(
|
||||||
raw: string,
|
raw: string,
|
||||||
sentinel: string,
|
|
||||||
commandCount: number,
|
commandCount: number,
|
||||||
): { outputs: string[][]; exitCodes: number[] } {
|
): { outputs: string[][]; exitCodes: number[] } {
|
||||||
const outputs: string[][] = []
|
const outputs: string[][] = []
|
||||||
|
|
@ -54,7 +53,7 @@ function parseSentinelOutput(
|
||||||
|
|
||||||
// Split by sentinel lines
|
// Split by sentinel lines
|
||||||
const sentinelRegex = new RegExp(
|
const sentinelRegex = new RegExp(
|
||||||
`${escapeRegex(sentinel)}(\\d+)_(\\d+)__`,
|
`${SENTINEL_PREFIX}(\\d+)_(\\d+)__`,
|
||||||
)
|
)
|
||||||
|
|
||||||
let remaining = raw
|
let remaining = raw
|
||||||
|
|
@ -146,7 +145,6 @@ export async function runFile(
|
||||||
|
|
||||||
const { outputs, exitCodes } = parseSentinelOutput(
|
const { outputs, exitCodes } = parseSentinelOutput(
|
||||||
stdout,
|
stdout,
|
||||||
SENTINEL_PREFIX,
|
|
||||||
file.commands.length,
|
file.commands.length,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user