aboutsummaryrefslogtreecommitdiff
path: root/test/cli/install/bunx.test.ts
diff options
context:
space:
mode:
authorGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-14 12:58:30 -0700
committerGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-14 12:58:30 -0700
commitf9add8b6bea4df3cdbd56a21f17e4cab1a854e4e (patch)
tree8e5306104d81c67b771181337bba02cd9ec39453 /test/cli/install/bunx.test.ts
parent81a1a58d66c598ea35c42453d0ba4c6341a940fc (diff)
parent9b5e66453b0879ed77b71dcdbe50e4efa184261e (diff)
downloadbun-sdl.tar.gz
bun-sdl.tar.zst
bun-sdl.zip
Merge branch 'main' into sdlsdl
Diffstat (limited to 'test/cli/install/bunx.test.ts')
-rw-r--r--test/cli/install/bunx.test.ts40
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);
+});