38 lines
800 B
JavaScript
38 lines
800 B
JavaScript
import { spawnSync } from "node:child_process";
|
|
|
|
const args = process.argv.slice(2);
|
|
let filterValue;
|
|
const passthroughArgs = [];
|
|
|
|
for (let index = 0; index < args.length; index += 1) {
|
|
const arg = args[index];
|
|
|
|
if (arg === "--filter") {
|
|
filterValue = args[index + 1];
|
|
index += 1;
|
|
continue;
|
|
}
|
|
|
|
passthroughArgs.push(arg);
|
|
}
|
|
|
|
const commandArgs = ["-r", "--if-present"];
|
|
|
|
if (filterValue) {
|
|
if (!filterValue.includes("/") && !filterValue.includes("*") && !filterValue.startsWith("@")) {
|
|
filterValue = `@aiquant/${filterValue}`;
|
|
}
|
|
|
|
commandArgs.push("--filter", filterValue);
|
|
}
|
|
|
|
commandArgs.push("test", "--", ...passthroughArgs);
|
|
|
|
const result = spawnSync("pnpm", commandArgs, {
|
|
cwd: process.cwd(),
|
|
shell: true,
|
|
stdio: "inherit"
|
|
});
|
|
|
|
process.exit(result.status ?? 1);
|