test: require node host path token · openclaw/openclaw@7d3cb57
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -53,6 +53,13 @@ type UnsafeRuntimeInvocationCase = {
|
53 | 53 | setup?: (tmp: string) => void; |
54 | 54 | }; |
55 | 55 | |
| 56 | +function requirePathToken(pathToken: PathTokenSetup | null): PathTokenSetup { |
| 57 | +if (!pathToken) { |
| 58 | +throw new Error("Expected PATH token fixture"); |
| 59 | +} |
| 60 | +return pathToken; |
| 61 | +} |
| 62 | + |
56 | 63 | function createScriptOperandFixture(tmp: string, fixture?: RuntimeFixture): ScriptOperandFixture { |
57 | 64 | if (fixture) { |
58 | 65 | return { |
@@ -386,7 +393,7 @@ describe("hardenApprovedExecutionPaths", () => {
|
386 | 393 | argv: ["poccmd", "SAFE"], |
387 | 394 | shellCommand: null, |
388 | 395 | withPathToken: true, |
389 | | -expectedArgv: ({ pathToken }) => [pathToken!.expected, "SAFE"], |
| 396 | +expectedArgv: ({ pathToken }) => [requirePathToken(pathToken).expected, "SAFE"], |
390 | 397 | expectedArgvChanged: true, |
391 | 398 | }, |
392 | 399 | { |
@@ -403,7 +410,7 @@ describe("hardenApprovedExecutionPaths", () => {
|
403 | 410 | mode: "build-plan", |
404 | 411 | argv: ["poccmd", "hello"], |
405 | 412 | withPathToken: true, |
406 | | -expectedArgv: ({ pathToken }) => [pathToken!.expected, "hello"], |
| 413 | +expectedArgv: ({ pathToken }) => [requirePathToken(pathToken).expected, "hello"], |
407 | 414 | checkRawCommandMatchesArgv: true, |
408 | 415 | expectedCommandPreview: null, |
409 | 416 | }, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。