Compare commits

...

2 Commits

Author SHA1 Message Date
Jarred-Sumner
c4a0fbbb2e bun run prettier 2025-07-06 12:02:18 +00:00
Jarred Sumner
1bf23a178b fix install task scheduling 2025-07-06 04:59:02 -07:00
2 changed files with 30 additions and 0 deletions

View File

@@ -426,6 +426,10 @@ pub fn installWithManager(
while (iter.next()) |entry| manager.enqueuePatchTaskPre(PatchTask.newCalcPatchHash(manager, entry.key_ptr.*, null));
}
manager.enqueueDependencyList(root.dependencies);
// schedule any downloads or patch tasks for the initial install
// otherwise pendingTaskCount() will remain zero and runTasks will never
// be triggered
manager.drainDependencyList();
} else {
{
var iter = manager.lockfile.patched_dependencies.iterator();

View File

@@ -0,0 +1,26 @@
import { expect, test } from "bun:test";
import { bunEnv, bunExe, tempDirWithFiles } from "harness";
import { join } from "path";
// Regression test for hanging installs when creating a new lockfile
// Ensure tasks are scheduled on first install
test("install completes with new lockfile", async () => {
const tarball = join(import.meta.dir, "../..", "cli", "install", "bar-0.0.2.tgz");
const dir = tempDirWithFiles("install-new-lockfile", {
"package.json": JSON.stringify({
name: "foo",
version: "1.0.0",
dependencies: { bar: "file:" + tarball },
}),
});
await using proc = Bun.spawn({
cmd: [bunExe(), "install"],
cwd: dir,
env: bunEnv,
});
const exitCode = await proc.exited;
expect(exitCode).toBe(0);
});