





















@@ -10,10 +10,19 @@ export function parseArgs(argv) {
1010const args = {
1111mode: "",
1212outputDir: process.env.OPENCLAW_VITEST_PROFILE_DIR?.trim() || "",
13+vitestArgs: [],
1314};
14151516for (let i = 0; i < argv.length; i += 1) {
1617const arg = argv[i];
18+if (arg === "--") {
19+const rest = argv.slice(i + 1);
20+if (rest[0] === "--output-dir") {
21+continue;
22+}
23+args.vitestArgs = rest;
24+break;
25+}
1726if (arg === "--output-dir") {
1827args.outputDir = argv[i + 1] ?? "";
1928i += 1;
@@ -44,6 +53,10 @@ export function resolveVitestProfileDir({ mode, outputDir }) {
4453}
45544655export function buildVitestProfileCommand({ mode, outputDir }) {
56+return buildVitestProfileCommandWithArgs({ mode, outputDir, vitestArgs: [] });
57+}
58+59+export function buildVitestProfileCommandWithArgs({ mode, outputDir, vitestArgs }) {
4760if (mode === "main") {
4861return {
4962command: process.execPath,
@@ -55,6 +68,7 @@ export function buildVitestProfileCommand({ mode, outputDir }) {
5568"--config",
5669"test/vitest/vitest.unit.config.ts",
5770"--no-file-parallelism",
71+ ...vitestArgs,
5872],
5973};
6074}
@@ -71,6 +85,7 @@ export function buildVitestProfileCommand({ mode, outputDir }) {
7185`--execArgv=--cpu-prof-dir=${outputDir}`,
7286"--execArgv=--heap-prof",
7387`--execArgv=--heap-prof-dir=${outputDir}`,
88+ ...vitestArgs,
7489],
7590};
7691}
@@ -99,9 +114,10 @@ function main() {
99114const outputDir = resolveVitestProfileDir(parsed);
100115fs.mkdirSync(outputDir, { recursive: true });
101116102-const plan = buildVitestProfileCommand({
117+const plan = buildVitestProfileCommandWithArgs({
103118mode: parsed.mode,
104119 outputDir,
120+vitestArgs: parsed.vitestArgs,
105121});
106122107123console.log(`[run-vitest-profile] writing ${parsed.mode} profiles to ${outputDir}`);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。