Skip to content

Commit bfffe7b

Browse files
committed
Guard the deps-requiring CLI tests so local npm test is green everywhere
The fail-fast test reaches cli.mjs's dynamic ioredis import, which is absent on a below-floor dev box -- so it failed locally while passing in CI. Same skip pattern as the other worker tests: skip when the queue deps cannot import, run in CI where PI_DISPATCH_REQUIRE_WORKER_TESTS makes a skip a hard failure. The validation tests (bad inputs, dirty tree) still run everywhere because they return before any import. Verified: local 94 pass / 26 skip / 0 fail; deps-present 8/8 CLI tests run.
1 parent 3c7c016 commit bfffe7b

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

worker/test/cli.test.mjs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ import { join } from "node:path";
66
import { test } from "node:test";
77
import { main } from "../src/cli.mjs";
88

9-
// cli.mjs dynamic-imports bullmq (in the `run` enqueue and `worker` paths), so the VALIDATION
10-
// paths -- which return before any enqueue -- run everywhere. That is exactly the safety surface
11-
// worth testing: nothing should reach the queue if the inputs are bad.
9+
// cli.mjs dynamic-imports bullmq/ioredis (in the `run` enqueue and `worker` paths), so the
10+
// VALIDATION paths -- which return before any enqueue -- run everywhere. That is exactly the safety
11+
// surface worth testing: nothing should reach the queue if the inputs are bad. Tests that DO reach
12+
// the enqueue need the queue deps; they skip below the node floor and run in CI.
13+
let depsOk = false;
14+
try {
15+
await import("../src/connection.mjs");
16+
depsOk = true;
17+
} catch {}
18+
const needsDeps = depsOk ? false : `queue deps not installed (node ${process.version} < 22.19.0); CI runs these`;
1219

1320
const env = { VALKEY_URL: "redis://127.0.0.1:6399" };
1421

@@ -59,7 +66,7 @@ test("run enqueues against a real Valkey (VALKEY_TEST_URL) and prints the job id
5966
assert.equal(code, 0, "a clean enqueue against a real Valkey returns 0");
6067
});
6168

62-
test("run fails FAST (does not hang) when Valkey is unreachable", async () => {
69+
test("run fails FAST (does not hang) when Valkey is unreachable", { skip: needsDeps }, async () => {
6370
// The whole point of failFast: a one-shot enqueue against a down Valkey must error in seconds,
6471
// not hang forever on ioredis's null retry policy. Port 1 is closed.
6572
const dir = gitRepo({ dirty: false });

0 commit comments

Comments
 (0)