test(update): initialize theme in isolated race test

This commit is contained in:
can1357
2026-08-13 17:31:44 +02:00
parent 69862139b3
commit 98682472e2
@@ -34,6 +34,7 @@ import {
import Update from "@oh-my-pi/pi-coding-agent/commands/update";
import { removeWithRetries } from "@oh-my-pi/pi-utils";
import type { CliConfig } from "@oh-my-pi/pi-utils/cli";
import { getThemeByName, setThemeInstance } from "../src/modes/theme/theme";
const tempDirs: string[] = [];
@@ -1110,6 +1111,9 @@ describe("update-cli concurrent binary updates", () => {
// unlink deleted A's temp file, so A's chmod failed with ENOENT even though
// its size + digest passed. Unique temp paths keep the two runs independent.
it("lets an overlapping slow run install after a fast run completes, instead of failing chmod with ENOENT", async () => {
const loadedTheme = await getThemeByName("dark");
if (!loadedTheme) throw new Error("theme unavailable");
setThemeInstance(loadedTheme);
vi.spyOn(console, "log").mockImplementation(() => {});
const dir = await makeTempDir();
const targetPath = path.join(dir, "omp");