MCPcopy
hub / github.com/vercel-labs/just-bash / truncateScript

Function truncateScript

packages/just-bash/src/spec-tests/bash/spec.test.ts:126–138  ·  view source on GitHub ↗

* Truncate script for test name display

(script: string, maxLen = 60)

Source from the content-addressed store, hash-verified

124 * Truncate script for test name display
125 */
126function truncateScript(script: string, maxLen = 60): string {
127 // Normalize whitespace and get first meaningful line(s)
128 const normalized = script
129 .split("\n")
130 .map((l) => l.trim())
131 .filter((l) => l && !l.startsWith("#"))
132 .join(" | ");
133
134 if (normalized.length <= maxLen) {
135 return normalized;
136 }
137 return `${normalized.slice(0, maxLen - 3)}...`;
138}
139
140/**
141 * Format error message for debugging

Callers 1

spec.test.tsFile · 0.85

Calls 1

splitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…