From a3cbc67a37b4aadc05154c93caef278b75f07ba4 Mon Sep 17 00:00:00 2001 From: Altay Date: Mon, 11 May 2026 11:08:06 +0300 Subject: [PATCH] test(pnpm): derive workflow pin from package manager --- ...is-telegram-desktop-proof-workflow.test.ts | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/test/scripts/mantis-telegram-desktop-proof-workflow.test.ts b/test/scripts/mantis-telegram-desktop-proof-workflow.test.ts index 168b676712b..b3886654f91 100644 --- a/test/scripts/mantis-telegram-desktop-proof-workflow.test.ts +++ b/test/scripts/mantis-telegram-desktop-proof-workflow.test.ts @@ -4,6 +4,7 @@ import { parse } from "yaml"; const PROOF_SCRIPT = "scripts/e2e/telegram-user-crabbox-proof.ts"; const USER_DRIVER = "scripts/e2e/telegram-user-driver.py"; +const PACKAGE_JSON = "package.json"; const WORKFLOW = ".github/workflows/mantis-telegram-desktop-proof.yml"; const LIVE_WORKFLOW = ".github/workflows/mantis-telegram-live.yml"; @@ -23,6 +24,19 @@ type Workflow = { jobs?: Record; }; +type PackageJson = { + packageManager?: string; +}; + +function repositoryPnpmVersion(): string { + const packageJson = JSON.parse(readFileSync(PACKAGE_JSON, "utf8")) as PackageJson; + const version = packageJson.packageManager?.match(/^pnpm@(.+)$/)?.[1]; + if (!version) { + throw new Error(`Missing pnpm packageManager pin in ${PACKAGE_JSON}`); + } + return version.split("+", 1)[0]; +} + function workflowStep(name: string): WorkflowStep { const workflow = parse(readFileSync(WORKFLOW, "utf8")) as Workflow; const steps = workflow.jobs?.run_telegram_desktop_proof?.steps ?? []; @@ -34,12 +48,13 @@ function workflowStep(name: string): WorkflowStep { } describe("Mantis Telegram Desktop proof workflow", () => { - it("runs with the repository pnpm major", () => { + it("uses the repository pnpm version pin", () => { const workflow = parse(readFileSync(WORKFLOW, "utf8")) as Workflow; const liveWorkflow = parse(readFileSync(LIVE_WORKFLOW, "utf8")) as Workflow; + const pnpmVersion = repositoryPnpmVersion(); - expect(workflow.env?.PNPM_VERSION).toBe("11.0.8"); - expect(liveWorkflow.env?.PNPM_VERSION).toBe("11.0.8"); + expect(workflow.env?.PNPM_VERSION).toBe(pnpmVersion); + expect(liveWorkflow.env?.PNPM_VERSION).toBe(pnpmVersion); }); it("uses the repo-owned Telegram user driver by default", () => {