Skip to content

Commit 163a5e9

Browse files
cliffhallclaude
andcommitted
test: skip the dispatch-status script tests without bash or jq
The job's script calls jq; on a machine without it the latest-run case posts error instead of success, failing the gate over a missing test prerequisite. Copilot round 1 on #5179. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent d533150 commit 163a5e9

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

‎scripts/version-pr-ci.test.mjs‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@ function runResultScript(script, { needs, newer }) {
112112
}
113113
}
114114

115+
// The job's script needs bash and jq, as on the ubuntu runner. Without
116+
// either (Windows, or a machine with no jq), skip rather than fail the gate
117+
// over a missing test prerequisite.
118+
const hasTool = (cmd) => spawnSync(cmd, ["--version"]).status === 0;
119+
const SCRIPT_SKIP =
120+
process.platform === "win32"
121+
? "runs the job's bash script"
122+
: !hasTool("bash")
123+
? "needs bash"
124+
: !hasTool("jq")
125+
? "needs jq, which the job's script calls"
126+
: false;
127+
115128
const FAILED = { a: { result: "failure" }, b: { result: "cancelled" } };
116129
const PASSED = { a: { result: "success" }, b: { result: "skipped" } };
117130
const CANCELLED = { a: { result: "success" }, b: { result: "cancelled" } };
@@ -125,7 +138,7 @@ for (const { file } of CI) {
125138
test(
126139
`${file}: a superseded run posts no status, whatever its jobs did`,
127140
{
128-
skip: process.platform === "win32" && "runs the job's bash script",
141+
skip: SCRIPT_SKIP,
129142
},
130143
() => {
131144
for (const needs of [FAILED, PASSED, CANCELLED])
@@ -136,7 +149,7 @@ for (const { file } of CI) {
136149
test(
137150
`${file}: the latest run posts success, failure or error`,
138151
{
139-
skip: process.platform === "win32" && "runs the job's bash script",
152+
skip: SCRIPT_SKIP,
140153
},
141154
() => {
142155
assert.equal(

0 commit comments

Comments
 (0)