diff options
Diffstat (limited to 'test/cli/install/bunx.test.ts')
-rw-r--r-- | test/cli/install/bunx.test.ts | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/test/cli/install/bunx.test.ts b/test/cli/install/bunx.test.ts index 0e1eba8f3..b8baceb1b 100644 --- a/test/cli/install/bunx.test.ts +++ b/test/cli/install/bunx.test.ts @@ -158,7 +158,7 @@ console.log( }); it("should work for github repository", async () => { - await rm(join(await realpath(tmpdir()), "@withfig"), { force: true, recursive: true }); + await rm(join(await realpath(tmpdir()), "github:piuccio"), { force: true, recursive: true }); // without cache const withoutCache = spawn({ cmd: [bunExe(), "x", "github:piuccio/cowsay", "--help"], @@ -195,3 +195,41 @@ it("should work for github repository", async () => { expect(out.trim()).toContain("Usage: cowsay"); expect(await cached.exited).toBe(0); }); + +it("should work for github repository with committish", async () => { + await rm(join(await realpath(tmpdir()), "github:piuccio"), { force: true, recursive: true }); + const withoutCache = spawn({ + cmd: [bunExe(), "x", "github:piuccio/cowsay#HEAD", "hello bun!"], + cwd: x_dir, + stdout: null, + stdin: "pipe", + stderr: "pipe", + env, + }); + + expect(withoutCache.stderr).toBeDefined(); + let err = await new Response(withoutCache.stderr).text(); + expect(err).not.toContain("error"); + expect(withoutCache.stdout).toBeDefined(); + let out = await new Response(withoutCache.stdout).text(); + expect(out.trim()).toContain("hello bun!"); + expect(await withoutCache.exited).toBe(0); + + // cached + const cached = spawn({ + cmd: [bunExe(), "x", "github:piuccio/cowsay#HEAD", "hello bun!"], + cwd: x_dir, + stdout: null, + stdin: "pipe", + stderr: "pipe", + env, + }); + + expect(cached.stderr).toBeDefined(); + err = await new Response(cached.stderr).text(); + expect(err).not.toContain("error"); + expect(cached.stdout).toBeDefined(); + out = await new Response(cached.stdout).text(); + expect(out.trim()).toContain("hello bun!"); + expect(await cached.exited).toBe(0); +}); |