fix: make root test use pnpm package filtering
This commit is contained in:
+1
-1
@@ -4,6 +4,6 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"packageManager": "pnpm@10.18.3",
|
"packageManager": "pnpm@10.18.3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "pnpm --filter @aiquant/shared test"
|
"test": "node scripts/workspace-test.mjs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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