diff options
author | 2023-08-09 10:43:04 -0700 | |
---|---|---|
committer | 2023-08-09 10:43:04 -0700 | |
commit | 8717303a80668e4043a9ae1586ff1d4d3b12ff00 (patch) | |
tree | 4d47b0d7c1a94720d0a5243cebda90b39f619d6d /test/cli/bun.test.ts | |
parent | 385d440694a95bc4bfee25daa602c5c4363b6423 (diff) | |
download | bun-8717303a80668e4043a9ae1586ff1d4d3b12ff00.tar.gz bun-8717303a80668e4043a9ae1586ff1d4d3b12ff00.tar.zst bun-8717303a80668e4043a9ae1586ff1d4d3b12ff00.zip |
Add support for `bun --revision` (#4027)
Co-authored-by: Yash Sharma <yashsharma@Yashs-MacBook-Air.local>
Diffstat (limited to '')
-rw-r--r-- | test/cli/bun.test.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/cli/bun.test.ts b/test/cli/bun.test.ts index 97ea52ecd..8bb3ca744 100644 --- a/test/cli/bun.test.ts +++ b/test/cli/bun.test.ts @@ -32,4 +32,31 @@ describe("bun", () => { }); } }); + + describe("revision", () => { + test("revision generates version numbers correctly", () => { + var { stdout, exitCode } = Bun.spawnSync({ + cmd: [bunExe(), "--version"], + env: {}, + stderr: "inherit", + }); + var version = stdout.toString().trim(); + + var { stdout, exitCode } = Bun.spawnSync({ + cmd: [bunExe(), "--revision"], + env: {}, + stderr: "inherit", + }); + var revision = stdout.toString().trim(); + + expect(exitCode).toBe(0); + expect(revision).toStartWith(version); + // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string + expect(revision).toMatch( + new RegExp( + "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", + ), + ); + }); + }); }); |