aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/bun.js/install/bun-add.test.ts49
-rw-r--r--test/bun.js/install/dummy.registry.ts2
2 files changed, 50 insertions, 1 deletions
diff --git a/test/bun.js/install/bun-add.test.ts b/test/bun.js/install/bun-add.test.ts
index 22974a82c..ef8025a6a 100644
--- a/test/bun.js/install/bun-add.test.ts
+++ b/test/bun.js/install/bun-add.test.ts
@@ -239,6 +239,55 @@ it("should handle @scoped names", async () => {
}
});
+it("should add dependency with capital letters", async () => {
+ const urls: string[] = [];
+ setHandler(dummyRegistry(urls));
+ await writeFile(
+ join(package_dir, "package.json"),
+ JSON.stringify({
+ name: "foo",
+ version: "0.0.1",
+ }),
+ );
+ const { stdout, stderr, exited } = spawn({
+ cmd: [bunExe(), "add", "BaR", "--config", import.meta.dir + "/basic.toml"],
+ cwd: package_dir,
+ stdout: null,
+ stdin: "pipe",
+ stderr: "pipe",
+ env,
+ });
+ expect(stderr).toBeDefined();
+ const err = await new Response(stderr).text();
+ expect(err).toContain("Saved lockfile");
+ expect(stdout).toBeDefined();
+ const out = await new Response(stdout).text();
+ expect(out.replace(/\s*\[[0-9\.]+m?s\]\s*$/, "").split(/\r?\n/)).toEqual([
+ "",
+ " installed BaR@0.0.2",
+ "",
+ "",
+ " 1 packages installed",
+ ]);
+ expect(await exited).toBe(0);
+ expect(urls.sort()).toEqual([`${root_url}/BaR`, `${root_url}/BaR-0.0.2.tgz`]);
+ expect(requested).toBe(2);
+ expect(await readdirSorted(join(package_dir, "node_modules"))).toEqual([".cache", "BaR"]);
+ expect(await readdirSorted(join(package_dir, "node_modules", "BaR"))).toEqual(["package.json"]);
+ expect(await file(join(package_dir, "node_modules", "BaR", "package.json")).json()).toEqual({
+ name: "bar",
+ version: "0.0.2",
+ });
+ expect(await file(join(package_dir, "package.json")).json()).toEqual({
+ name: "foo",
+ version: "0.0.1",
+ dependencies: {
+ BaR: "^0.0.2",
+ },
+ });
+ await access(join(package_dir, "bun.lockb"));
+});
+
it("should add dependency with specified semver", async () => {
const urls: string[] = [];
setHandler(
diff --git a/test/bun.js/install/dummy.registry.ts b/test/bun.js/install/dummy.registry.ts
index fd6e652a8..bc4554a47 100644
--- a/test/bun.js/install/dummy.registry.ts
+++ b/test/bun.js/install/dummy.registry.ts
@@ -12,7 +12,7 @@ export function dummyRegistry(urls, info: any = { "0.0.2": {} }) {
urls.push(request.url);
expect(request.method).toBe("GET");
if (request.url.endsWith(".tgz")) {
- return new Response(file(join(import.meta.dir, basename(request.url))));
+ return new Response(file(join(import.meta.dir, basename(request.url).toLowerCase())));
}
expect(request.headers.get("accept")).toBe(
"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",
v class='content'>
AgeCommit message (Expand)AuthorFilesLines
2022-12-08[ci] formatGravatar matthewp 2-2/+4
2022-12-08fix: Error reporting fails on undefined error index (#5539)Gravatar wulinsheng123 2-1/+6
2022-12-08astro-rss: Generate feed with proper XML escaping (#5550)Gravatar Anders Kaseorg 5-36/+57
2022-12-08Fix Astro.params not having values when using base in SSR (#5553)Gravatar Matthew Phillips 6-4/+66
2022-12-07Allow all redirection status codes in redirect() (#5446)Gravatar Jeffrey Yasskin 2-1/+6
2022-12-06feat(astro-rss): generate post content in feed (#5366)Gravatar Ben Smith 4-1/+46
2022-12-06[ci] formatGravatar matthewp 2-7/+6
2022-12-06Use accumulated sort order when order production CSS (#5549)Gravatar Matthew Phillips 15-2/+180
2022-12-06[ci] formatGravatar matthewp 22-158/+171
2022-12-06Head propagation (#5511)Gravatar Matthew Phillips 36-279/+804
2022-12-06[ci] formatGravatar matthewp 1-7/+7
2022-12-06Removed premature optimization (#5548)Gravatar Ido S 2-37/+35
2022-12-06Exclude astro from Vite optimization (#5545)Gravatar Bjorn Lu 2-1/+6
2022-12-06bench workflow - use bash as shell (#5546)Gravatar Matthew Phillips 1-2/+4
2022-12-06bench workflow - pipe stderr (#5543)Gravatar Matthew Phillips 1-2/+4
2022-12-06Update esbuild dependency (#5534)Gravatar Bjorn Lu 7-18/+275
2022-12-06Fix tests with node 18 (#5528)Gravatar Bjorn Lu 1-9/+14