mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
* 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>
22 lines
642 B
TypeScript
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];
|
|
}
|