diff options
author | 2023-08-03 22:37:29 +0300 | |
---|---|---|
committer | 2023-08-03 12:37:29 -0700 | |
commit | 9a2c3dea88b22351ecc85126b0c225bfefea71bf (patch) | |
tree | 628b622fdd1ed27f908049dc4b54532d44cbbf19 /test | |
parent | 2c9ff9584a0294a2e65a995d0012dd1e9a7aedc3 (diff) | |
download | bun-9a2c3dea88b22351ecc85126b0c225bfefea71bf.tar.gz bun-9a2c3dea88b22351ecc85126b0c225bfefea71bf.tar.zst bun-9a2c3dea88b22351ecc85126b0c225bfefea71bf.zip |
[install] fix stale `bun.lockb` on workspaces (#3945)
- handle workspaces under `--production` correctly
- fix `Makefile`
Diffstat (limited to 'test')
-rw-r--r-- | test/cli/install/bun-install.test.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/cli/install/bun-install.test.ts b/test/cli/install/bun-install.test.ts index bdd098126..b8f2508c4 100644 --- a/test/cli/install/bun-install.test.ts +++ b/test/cli/install/bun-install.test.ts @@ -724,6 +724,7 @@ it("should handle life-cycle scripts during re-installation", async () => { }); expect(stderr2).toBeDefined(); const err2 = await new Response(stderr2).text(); + expect(err2).not.toContain("error:"); expect(err2).not.toContain("Saved lockfile"); expect(stdout2).toBeDefined(); const out2 = await new Response(stdout2).text(); @@ -739,6 +740,38 @@ it("should handle life-cycle scripts during re-installation", async () => { expect(await readdirSorted(join(package_dir, "node_modules"))).toEqual(["Bar"]); expect(await readlink(join(package_dir, "node_modules", "Bar"))).toBe(join("..", "bar")); await access(join(package_dir, "bun.lockb")); + // Perform `bun install --production` with lockfile from before + await rm(join(package_dir, "node_modules"), { force: true, recursive: true }); + const { + stdout: stdout3, + stderr: stderr3, + exited: exited3, + } = spawn({ + cmd: [bunExe(), "install", "--production"], + cwd: package_dir, + stdout: null, + stdin: "pipe", + stderr: "pipe", + env, + }); + expect(stderr3).toBeDefined(); + const err3 = await new Response(stderr3).text(); + expect(err3).not.toContain("error:"); + expect(err3).not.toContain("Saved lockfile"); + expect(stdout3).toBeDefined(); + const out3 = await new Response(stdout3).text(); + expect(out3.replace(/\s*\[[0-9\.]+m?s\]\s*$/, "").split(/\r?\n/)).toEqual([ + "[scripts:run] Bar", + " + Bar@workspace:bar", + "[scripts:run] Foo", + "", + " 1 packages installed", + ]); + expect(await exited3).toBe(0); + expect(requested).toBe(0); + expect(await readdirSorted(join(package_dir, "node_modules"))).toEqual(["Bar"]); + expect(await readlink(join(package_dir, "node_modules", "Bar"))).toBe(join("..", "bar")); + await access(join(package_dir, "bun.lockb")); }); it("should ignore workspaces within workspaces", async () => { |