diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index de5463b..3b64c90 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 with: - node-version: '22' + node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' cache: npm @@ -38,7 +38,9 @@ jobs: id: release run: node scripts/check-release.js + # The build normally takes about a minute; a stalled test fails the run instead of blocking it. - name: Build and test + timeout-minutes: 10 run: npm run build - name: Inspect package diff --git a/scripts/__tests__/check-release.test.js b/scripts/__tests__/check-release.test.js index 160d553..2b94b1b 100644 --- a/scripts/__tests__/check-release.test.js +++ b/scripts/__tests__/check-release.test.js @@ -128,6 +128,20 @@ describe("publish workflow", () => { } }); + // Node 22 aborted context.test.js and left Jest waiting for 30+ minutes (v1.14.0, run 45978491550). + test("builds on the .nvmrc Node version, as CI does, and fails a stalled build in minutes", () => { + const setup = job.steps.find((step) => /actions\/setup-node@/.test(step.uses || "")); + expect(setup.with["node-version-file"]).toBe(".nvmrc"); + expect(setup.with["node-version"]).toBeUndefined(); + expect(setup.with["registry-url"]).toBe("https://registry.npmjs.org"); + const build = job.steps.find((step) => step.run === "npm run build"); + expect(build["timeout-minutes"]).toBeGreaterThan(0); + expect(build["timeout-minutes"]).toBeLessThanOrEqual(15); + const ci = yaml.load(readFileSync(path.join(__dirname, "../../.github/workflows/build.yml"), "utf8")); + const ciSetup = ci.jobs.build.steps.find((step) => /actions\/setup-node@/.test(step.uses || "")); + expect(ciSetup.with["node-version-file"]).toBe(setup.with["node-version-file"]); + }); + test("serializes all releases with one fixed package-wide lock without cancelling a running publish", () => { expect(Object.keys(workflow.jobs)).toEqual(["publish"]); expect(job.concurrency).toEqual({ diff --git a/src/__tests__/context.test.js b/src/__tests__/context.test.js index 9f96773..ebf252f 100644 --- a/src/__tests__/context.test.js +++ b/src/__tests__/context.test.js @@ -6919,7 +6919,15 @@ describe("Context", () => { }, }); context.attribute("user", user); - expect(context.variableValue("button.color", "D")).toBe("WINNER_AFTER_HOLDOUT"); + // The feedback recurses past the stack, and the SDK logs the caught RangeError there. A real + // console would format it with almost no stack left, which aborts the process on Node 22.23. + const consoleError = jest.spyOn(console, "error").mockImplementation(() => {}); + try { + expect(context.variableValue("button.color", "D")).toBe("WINNER_AFTER_HOLDOUT"); + expect(consoleError.mock.calls.every(([e]) => e instanceof RangeError)).toBe(true); + } finally { + consoleError.mockRestore(); + } // Without the callback budget each round doubles the held list until round 32. expect(errors).toBeGreaterThan(2048); expect(maxRetained).toBeLessThanOrEqual(1024);