fix(test): keep wrapper help metadata-only · openclaw/openclaw@731a7af
vincentkoc
·
2026-05-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -49,6 +49,25 @@ const releaseLockOnce = () => {
|
49 | 49 | releaseLock(); |
50 | 50 | }; |
51 | 51 | |
| 52 | +function isWrapperMetadataRequest(args) { |
| 53 | +for (const arg of args) { |
| 54 | +if (arg === "--") { |
| 55 | +return false; |
| 56 | +} |
| 57 | +if (arg === "--help" || arg === "-h") { |
| 58 | +return true; |
| 59 | +} |
| 60 | +} |
| 61 | +return false; |
| 62 | +} |
| 63 | + |
| 64 | +function printHelp() { |
| 65 | +console.log(`Usage: node scripts/test-projects.mjs [--changed <base>] [--watch] [targets...] [-- vitest-args...] |
| 66 | + |
| 67 | +Runs the Vitest project shards that own the requested targets. With no targets, |
| 68 | +this runs the full local suite. Use explicit targets for local edit loops.`); |
| 69 | +} |
| 70 | + |
52 | 71 | function cleanupVitestRunSpec(spec) { |
53 | 72 | if (!spec.includeFilePath) { |
54 | 73 | return; |
@@ -192,6 +211,10 @@ async function runVitestSpecsParallel(specs, concurrency) {
|
192 | 211 | async function main() { |
193 | 212 | const suiteStartedAt = performance.now(); |
194 | 213 | const args = process.argv.slice(2); |
| 214 | +if (isWrapperMetadataRequest(args)) { |
| 215 | +printHelp(); |
| 216 | +return; |
| 217 | +} |
195 | 218 | const baseEnv = resolveLocalVitestEnv(process.env); |
196 | 219 | const { targetArgs } = parseTestProjectsArgs(args, process.cwd()); |
197 | 220 | const unmatchedExplicitTargets = findUnmatchedExplicitTestTargets(args, process.cwd()); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -569,6 +569,17 @@ describe("scripts/test-projects changed-target routing", () => {
|
569 | 569 | ]); |
570 | 570 | }); |
571 | 571 | |
| 572 | +it("prints wrapper help without starting a broad local suite", () => { |
| 573 | +const result = spawnSync(process.execPath, ["scripts/test-projects.mjs", "--help"], { |
| 574 | +encoding: "utf8", |
| 575 | +timeout: 5_000, |
| 576 | +}); |
| 577 | + |
| 578 | +expect(result.status).toBe(0); |
| 579 | +expect(result.stdout).toContain("Usage: node scripts/test-projects.mjs"); |
| 580 | +expect(result.stderr).not.toContain("[test] starting"); |
| 581 | +}); |
| 582 | + |
572 | 583 | it("allows explicit split Vitest config targets without treating them as unmatched tests", () => { |
573 | 584 | expect( |
574 | 585 | findUnmatchedExplicitTestTargets( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。