mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Avoid Bun filter-mode repository scans that exhaust macOS file descriptors and corrupt subprocess test evidence. Apply rooted filters across server, contract, coverage, persistence, policy, desktop native, and adapter test entrypoints. Confidence: high Scope-risk: narrow Tested: bun run check:policy; bun run check:server; bun run check:chat-contract
21 lines
583 B
TypeScript
21 lines
583 B
TypeScript
import { isAbsolute } from 'node:path'
|
|
|
|
const WINDOWS_ABSOLUTE_PATH = /^(?:[a-zA-Z]:[\\/]|\\\\)/
|
|
|
|
/**
|
|
* Root explicit Bun test filters so Bun does not scan the whole repository.
|
|
* Unrooted filters can retain enough directory descriptors on macOS to break
|
|
* subprocess output capture: https://github.com/oven-sh/bun/issues/32067
|
|
*/
|
|
export function rootBunTestFilter(filter: string): string {
|
|
if (
|
|
filter.startsWith('./') ||
|
|
filter.startsWith('../') ||
|
|
isAbsolute(filter) ||
|
|
WINDOWS_ABSOLUTE_PATH.test(filter)
|
|
) {
|
|
return filter
|
|
}
|
|
return `./${filter}`
|
|
}
|