aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cli/install/bunx.test.ts40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/cli/install/bunx.test.ts b/test/cli/install/bunx.test.ts
index c353aa123..d60e80995 100644
--- a/test/cli/install/bunx.test.ts
+++ b/test/cli/install/bunx.test.ts
@@ -156,3 +156,43 @@ console.log(
expect(await exited).toBe(0);
expect(await readdirSorted(x_dir)).toEqual(["test.js"]);
});
+
+it("should work for github repository", async () => {
+ await rm(join(await realpath(tmpdir()), "@withfig"), { force: true, recursive: true });
+ // without cache
+ const withoutCache = spawn({
+ cmd: [bunExe(), "x", "github:piuccio/cowsay", "--help"],
+ 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("Usage: cowsay");
+ expect(await withoutCache.exited).toBe(0);
+
+ // cached
+ const cached = spawn({
+ cmd: [bunExe(), "x", "github:piuccio/cowsay", "--help"],
+ 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("Usage: cowsay");
+ expect(await cached.exited).toBe(0);
+});
+