From 4915ff769aa7b0d3b11187d02a068cfab66c07f0 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Feb 2026 01:36:29 +0000 Subject: [PATCH] Cover CLI version fallback for blank env value Co-authored-by: Theo Browne --- apps/t3/src/cli.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/t3/src/cli.test.ts b/apps/t3/src/cli.test.ts index f736301b7f..a30faeaac7 100644 --- a/apps/t3/src/cli.test.ts +++ b/apps/t3/src/cli.test.ts @@ -405,6 +405,16 @@ describe("readCliVersion", () => { expect(value).toBe("9.9.9"); }); + it("falls back when npm_package_version is whitespace-only", () => { + const tempDir = mkdtempSync(path.join(os.tmpdir(), "t3-version-env-fallback-")); + const packageJsonPath = path.join(tempDir, "package.json"); + writeFileSync(packageJsonPath, JSON.stringify({ version: "1.2.3" }), "utf8"); + const value = readCliVersion(packageJsonPath, { + npm_package_version: " ", + }); + expect(value).toBe("1.2.3"); + }); + it("falls back to package json version when env is missing", () => { const tempDir = mkdtempSync(path.join(os.tmpdir(), "t3-version-test-")); const packageJsonPath = path.join(tempDir, "package.json");