MCPcopy Index your code
hub / github.com/deepnote/deepnote / withStableTmpPaths

Function withStableTmpPaths

packages/cli/src/commands/lint.test.ts:48–53  ·  view source on GitHub ↗

Normalize the per-run temp dir (absolute and cwd-relative forms) so text snapshots are stable.

(text: string, tempDir: string)

Source from the content-addressed store, hash-verified

46
47/** Normalize the per-run temp dir (absolute and cwd-relative forms) so text snapshots are stable. */
48function withStableTmpPaths(text: string, tempDir: string): string {
49 // Replace the cwd-relative form first: the absolute tempDir is a substring of it, so
50 // replacing the absolute form first would leave a machine-dependent `../..` prefix behind.
51 const relTmp = relative(process.cwd(), tempDir)
52 return text.split(relTmp).join('<tmp>').split(tempDir).join('<tmp>').split(sep).join('/')
53}
54
55describe('lint command', () => {
56 let program: Command

Callers 1

lint.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected