Skip to content

Commit c9b86b7

Browse files
authored
test(cli): add version display test to verify package.json reading (#1134)
Closes #1063 Investigation findings: - The CLI code correctly reads version from package.json - The reported issue (bunx showing old version) is a caching issue - Added test to ensure version is read as valid semver from package.json Co-authored-by: justsisyphus <justsisyphus@users.noreply.github.com>
1 parent 9b6d8f6 commit c9b86b7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/cli/index.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { describe, it, expect } from "bun:test"
2+
import packageJson from "../../package.json" with { type: "json" }
3+
4+
describe("CLI version", () => {
5+
it("reads version from package.json as valid semver", () => {
6+
//#given
7+
const semverRegex = /^\d+\.\d+\.\d+(-[\w.]+)?$/
8+
9+
//#when
10+
const version = packageJson.version
11+
12+
//#then
13+
expect(version).toMatch(semverRegex)
14+
expect(typeof version).toBe("string")
15+
expect(version.length).toBeGreaterThan(0)
16+
})
17+
})

0 commit comments

Comments
 (0)