fix: make root test use pnpm package filtering
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user