The best way to control Claude Code, Codex and more from any computer or phone
fix(scripts): check:changed no longer passes failing .github/scripts tests (#28296)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Victor Vogel committed
Nov 1, 2026 at 16:03 UTC
99be504b8ae75321c26a65f164b8e8b1cb4def4b
2 files changed
+42
-3
scripts/check-changed.test.ts
+19
@@ -21,6 +21,7 @@ import {
21
docReaderTests,
22
gitLines,
23
runSteps,
24
+ splitTests,
25
type Step,
26
} from "./check-changed.ts";
27
import { decide, readWorkspace } from "../.github/scripts/ci-changes.cjs";
@@ -142,6 +143,24 @@ describe("check:changed", () => {
143
}),
144
);
145
146
+ it("runs the .github/scripts node:test files with node --test, not vitest", () => {
147
+ assert.deepStrictEqual(
148
+ splitTests([
149
+ "apps/server/src/ws.test.ts",
150
+ ".github/scripts/ci-changes.test.cjs",
151
+ ".github\\scripts\\thread-transfer-report.test.cjs",
152
+ "scripts/check-changed.test.ts",
153
+ ]),
154
+ {
155
+ vitestTests: ["apps/server/src/ws.test.ts", "scripts/check-changed.test.ts"],
156
+ nodeTests: [
157
+ ".github/scripts/ci-changes.test.cjs",
158
+ ".github\\scripts\\thread-transfer-report.test.cjs",
159
+ ],
160
+ },
161
+ );
162
+ });
163
+
164
it.effect("fails instead of returning an empty file list when git exits nonzero", () => {
165
const spawner = (exitCode: number) =>
166
ChildProcessSpawner.make(() =>
scripts/check-changed.ts
+23
-3
@@ -174,6 +174,15 @@ export const comparisonBase = Effect.fn("checkChanged.comparisonBase")(function*
174
175
const CODE = /\.[cm]?[jt]sx?$/;
176
const TEST = /\.test\.[cm]?[jt]sx?$/;
177
+// CI runs the .github/scripts tests with `node --test`; vitest passes a failing node:test file.
178
+const NODE_TEST = /^\.github[/\\]scripts[/\\]/;
179
+export const splitTests = (tests: Iterable<string>) => {
180
+ const all = [...tests];
181
+ return {
182
+ vitestTests: all.filter((file) => !NODE_TEST.test(file)),
183
+ nodeTests: all.filter((file) => NODE_TEST.test(file)),
184
+ };
185
+};
186
const escapeRegExp = (text: string) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
187
188
// A flag wins over its environment variable; either must be a positive integer.
@@ -319,6 +328,7 @@ const checkChanged = Effect.fn("checkChanged")(function* (input: {
328
for (const test of docReaderTests(files)) tests.add(test);
329
// It reads files other than the ones beside it, so no changed file selects it.
330
if (affected.includes("t3")) tests.add("apps/server/src/provider/AgentContextBudget.test.ts");
331
+ const { vitestTests, nodeTests } = splitTests(tests);
332
333
// React Compiler coverage compiles every client source file, so run only the
334
// changed files' cases, in one extra step: a -t filter in the main test step
@@ -485,19 +495,29 @@ const checkChanged = Effect.fn("checkChanged")(function* (input: {
495
]
496
: []),
497
// From the repo root, the root vite.config.ts hands each file to its package's config.
488
- ...(tests.size > 0
498
+ ...(vitestTests.length > 0
499
? [
500
{
491
- ...command(`test (${tests.size} files)`, [
501
+ ...command(`test (${vitestTests.length} files)`, [
502
"test",
503
"run",
504
"--passWithNoTests",
495
- ...tests,
505
+ ...vitestTests,
506
]),
507
serial: true,
508
},
509
]
510
: []),
511
+ ...(nodeTests.length > 0
512
+ ? [
513
+ command(`node --test (${nodeTests.length} files)`, [
514
+ "exec",
515
+ "node",
516
+ "--test",
517
+ ...nodeTests,
518
+ ]),
519
+ ]
520
+ : []),
521
...(compilerApps.length > 0
522
? [
523
{