diff options
author | 2023-10-03 15:49:24 -0300 | |
---|---|---|
committer | 2023-10-03 11:49:24 -0700 | |
commit | 0ca9a7889abd43a36295c60c0534ca3a30003331 (patch) | |
tree | 5c0194ee5da3a63a4deaedcff0246a9eb9549ea6 /test | |
parent | 476fa4deda73ce3d63a2fb8175e66678434668d6 (diff) | |
download | bun-0ca9a7889abd43a36295c60c0534ca3a30003331.tar.gz bun-0ca9a7889abd43a36295c60c0534ca3a30003331.tar.zst bun-0ca9a7889abd43a36295c60c0534ca3a30003331.zip |
Fix bunx command for github package #5974 (#6042)
* fix bunx command for github package
* refactor fmt package to use it when the path is seted
* use labeled block to assign const instead of use 'undefined'
Diffstat (limited to 'test')
-rw-r--r-- | test/cli/install/bunx.test.ts | 40 |
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); +}); + |