Skip to content

Commit f90f52a

Browse files
suryaiyer95claude
andcommitted
fix: spread real child_process in mock.module to prevent execFileSync leak
`mock.module("child_process")` in `dbt-cli.test.ts` only provided `execFile`, causing `dbt-resolve.test.ts` to fail with `Export named 'execFileSync' not found` when Bun leaks the mock across test files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d6c92af commit f90f52a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/dbt-tools/test/dbt-cli.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import { describe, test, expect, mock, beforeEach } from "bun:test"
2+
import * as realChildProcess from "child_process"
23

3-
// We test the parsing logic by mocking execFile
4+
// We test the parsing logic by mocking execFile.
5+
// Spread the real module so other exports (execFileSync, etc.)
6+
// remain available — mock.module leaks across test files in Bun.
47
const mockExecFile = mock((cmd: string, args: string[], opts: any, cb: Function) => {
58
cb(null, "", "")
69
})
710

811
mock.module("child_process", () => ({
12+
...realChildProcess,
913
execFile: mockExecFile,
1014
}))
1115

0 commit comments

Comments
 (0)