diff --git a/scripts/check-migrations.mjs b/scripts/check-migrations.mjs index 8b62f65366..f8d5862ba0 100644 --- a/scripts/check-migrations.mjs +++ b/scripts/check-migrations.mjs @@ -76,4 +76,7 @@ for (let i = 1; i < numbers.length; i += 1) { const first = String(numbers[0]).padStart(4, "0"); const last = String(numbers.at(-1)).padStart(4, "0"); -process.stdout.write(`check-migrations: ${files.length} migrations OK — contiguous ${first}..${last} (2 grandfathered duplicates: 0015, 0017), no new duplicates. Next free: ${nextFree()}\n`); +const grandfatheredNumbers = [...KNOWN_DUPLICATES.keys()] + .sort((a, b) => a - b) + .map((number) => String(number).padStart(4, "0")); +process.stdout.write(`check-migrations: ${files.length} migrations OK — contiguous ${first}..${last} (${grandfatheredNumbers.length} grandfathered duplicates: ${grandfatheredNumbers.join(", ")}), no new duplicates. Next free: ${nextFree()}\n`); diff --git a/test/unit/check-migrations-script.test.ts b/test/unit/check-migrations-script.test.ts new file mode 100644 index 0000000000..f91e7c7d2d --- /dev/null +++ b/test/unit/check-migrations-script.test.ts @@ -0,0 +1,10 @@ +import { execFileSync } from "node:child_process"; +import { describe, expect, it } from "vitest"; + +describe("check-migrations script", () => { + it("reports every grandfathered duplicate migration number in the success summary", () => { + const output = execFileSync(process.execPath, ["scripts/check-migrations.mjs"], { encoding: "utf8" }); + + expect(output).toContain("(3 grandfathered duplicates: 0015, 0017, 0074)"); + }); +});