Skip to content

Commit

Permalink
fix snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-conway committed Dec 15, 2024
1 parent 3194184 commit 145bef8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ exports[`binaries root resolution bins 1`] = `
"packages": {
"fooooo": ["fooooo@root:", { "bin": "fooooo.js" }],
"no-deps": ["[email protected]", "http://localhost:37292/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
"no-deps": ["[email protected]", "http://localhost:1234/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
}
}
"
Expand Down
29 changes: 23 additions & 6 deletions test/cli/install/registry/bun-install-registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3354,7 +3354,10 @@ describe("binaries", () => {

expect(await exited).toBe(0);

const firstLockfile = await Bun.file(join(packageDir, "bun.lock")).text();
const firstLockfile = (await Bun.file(join(packageDir, "bun.lock")).text()).replaceAll(
/localhost:\d+/g,
"localhost:1234",
);

expect(join(packageDir, "node_modules", ".bin", "file-bin")).toBeValidBin(join("..", "file-bin", "file-bin.js"));
expect(join(packageDir, "node_modules", ".bin", "named-file-bin")).toBeValidBin(
Expand Down Expand Up @@ -3383,7 +3386,9 @@ describe("binaries", () => {

expect(await exited).toBe(0);

expect(firstLockfile).toBe(await Bun.file(join(packageDir, "bun.lock")).text());
expect(firstLockfile).toBe(
(await Bun.file(join(packageDir, "bun.lock")).text()).replaceAll(/localhost:\d+/g, "localhost:1234"),
);
expect(firstLockfile).toMatchSnapshot();

expect(join(packageDir, "node_modules", ".bin", "file-bin")).toBeValidBin(join("..", "file-bin", "file-bin.js"));
Expand Down Expand Up @@ -3435,7 +3440,10 @@ describe("binaries", () => {

expect(await exited).toBe(0);

const firstLockfile = await Bun.file(join(packageDir, "bun.lock")).text();
const firstLockfile = (await Bun.file(join(packageDir, "bun.lock")).text()).replaceAll(
/localhost:\d+/g,
"localhost:1234",
);

expect(join(packageDir, "node_modules", ".bin", "change-bin-1")).toBeValidBin(
join("..", "change-bin", "change-bin-1.js"),
Expand Down Expand Up @@ -3472,7 +3480,10 @@ describe("binaries", () => {

expect(await exited).toBe(0);

const secondLockfile = await Bun.file(join(packageDir, "bun.lock")).text();
const secondLockfile = (await Bun.file(join(packageDir, "bun.lock")).text()).replaceAll(
/localhost:\d+/g,
"localhost:1234",
);
expect(firstLockfile).not.toBe(secondLockfile);

expect(secondLockfile).toMatchSnapshot();
Expand Down Expand Up @@ -3540,7 +3551,11 @@ describe("binaries", () => {
expect(out).toContain("[email protected]");

expect(await exited).toBe(0);
const firstLockfile = await Bun.file(join(packageDir, "bun.lock")).text();

const firstLockfile = (await Bun.file(join(packageDir, "bun.lock")).text()).replaceAll(
/localhost:\d+/g,
"localhost:1234",
);

expect(join(packageDir, "node_modules", ".bin", "fooooo")).toBeValidBin(join("..", "fooooo.js"));

Expand All @@ -3563,7 +3578,9 @@ describe("binaries", () => {

expect(await exited).toBe(0);

expect(firstLockfile).toBe(await Bun.file(join(packageDir, "bun.lock")).text());
expect(firstLockfile).toBe(
(await Bun.file(join(packageDir, "bun.lock")).text()).replaceAll(/localhost:\d+/g, "localhost:1234"),
);
expect(firstLockfile).toMatchSnapshot();

expect(join(packageDir, "node_modules", ".bin", "fooooo")).toBeValidBin(join("..", "fooooo.js"));
Expand Down

0 comments on commit 145bef8

Please sign in to comment.