diff options
author | 2023-09-20 01:00:29 -0700 | |
---|---|---|
committer | 2023-09-20 01:00:29 -0700 | |
commit | 5d09a061004804e7f6e7cf55c3d30068efa33387 (patch) | |
tree | e686fc12b63c82d210892f10e3eef631ecc12cc8 /test | |
parent | 4a0eb19038fc1ae7debf6f4e67a08d53ea67a7de (diff) | |
download | bun-5d09a061004804e7f6e7cf55c3d30068efa33387.tar.gz bun-5d09a061004804e7f6e7cf55c3d30068efa33387.tar.zst bun-5d09a061004804e7f6e7cf55c3d30068efa33387.zip |
Fix path used in bunx (#5785)
* Fix path used in bunx
* Add test
* Use a different package
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/cli/install/bunx.test.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/cli/install/bunx.test.ts b/test/cli/install/bunx.test.ts index 70d7aac29..c353aa123 100644 --- a/test/cli/install/bunx.test.ts +++ b/test/cli/install/bunx.test.ts @@ -15,6 +15,26 @@ afterEach(async () => { await rm(x_dir, { force: true, recursive: true }); }); +it("should choose the tagged versions instead of the PATH versions when a tag is specified", async () => { + const processes = Array.from({ length: 3 }, (_, i) => { + return spawn({ + cmd: [bunExe(), "x", "semver@7.5." + i, "--help"], + cwd: x_dir, + stdout: "pipe", + stdin: "ignore", + stderr: "inherit", + env, + }); + }); + + const results = await Promise.all(processes.map(p => p.exited)); + expect(results).toEqual([0, 0, 0]); + const outputs = (await Promise.all(processes.map(p => new Response(p.stdout).text()))).map(a => + a.substring(0, a.indexOf("\n")), + ); + expect(outputs).toEqual(["SemVer 7.5.0", "SemVer 7.5.1", "SemVer 7.5.2"]); +}); + it("should install and run default (latest) version", async () => { const { stdout, stderr, exited } = spawn({ cmd: [bunExe(), "x", "uglify-js", "--compress"], |