openclaw/scripts/lib/native-test-runner.ts
Peter Steinberger f364a0c544
fix(test): repair Bun source fixtures and subprocess launches (#156581)
* fix(test): repair Bun source fixtures and subprocess launches

* fix(test): declare repo root helper and align runtime inventory

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-09-23 12:19:54 -07:00

22 lines
642 B
TypeScript

import path from "node:path";
type NativeTestRunnerOptions = {
node?: readonly string[];
bun?: readonly string[];
};
/** Select the current executable's native test CLI without changing its runtime. */
export function nativeTestRunnerArgs(
files: readonly string[],
options: NativeTestRunnerOptions = {},
): string[] {
if (process.versions.bun) {
// Bare relative paths are Bun substring filters; ./ selects the exact file.
return [
"test",
...(options.bun ?? []),
...files.map((file) => (path.isAbsolute(file) ? file : `./${file}`)),
];
}
return [...(options.node ?? []), "--test", ...files];
}