

























@@ -373,21 +373,19 @@ describe("launchd runtime state", () => {
373373state.files.set(resolveLaunchAgentPlistPath(env), "<plist/>");
374374state.serviceLoaded = false;
375375376-await expect(readLaunchAgentRuntime(env)).resolves.toMatchObject({
377-status: "unknown",
378-missingSupervision: true,
379-detail: "Could not find service",
380-});
376+const runtime = await readLaunchAgentRuntime(env);
377+expect(runtime.status).toBe("unknown");
378+expect(runtime.missingSupervision).toBe(true);
379+expect(runtime.detail).toBe("Could not find service");
381380});
382381383382it("marks a missing unit when launchd has no job and no plist exists", async () => {
384383const env = createDefaultLaunchdEnv();
385384state.serviceLoaded = false;
386385387-await expect(readLaunchAgentRuntime(env)).resolves.toMatchObject({
388-status: "unknown",
389-missingUnit: true,
390-});
386+const runtime = await readLaunchAgentRuntime(env);
387+expect(runtime.status).toBe("unknown");
388+expect(runtime.missingUnit).toBe(true);
391389});
392390});
393391@@ -470,11 +468,12 @@ describe("launchd bootstrap repair", () => {
470468471469const repair = await repairLaunchAgentBootstrap({ env });
472470473-expect(repair).toMatchObject({
474-ok: false,
475-status: "bootstrap-failed",
476-detail: expect.stringContaining("Could not find specified service"),
477-});
471+expect(repair.ok).toBe(false);
472+if (repair.ok) {
473+throw new Error("expected bootstrap repair to fail");
474+}
475+expect(repair.status).toBe("bootstrap-failed");
476+expect(repair.detail).toContain("Could not find specified service");
478477expect(launchctlCommandNames()).not.toContain("kickstart");
479478});
480479@@ -540,14 +539,10 @@ describe("launchd install", () => {
540539541540const command = await readLaunchAgentProgramArguments(env);
542541expect(command?.programArguments).toEqual(defaultProgramArguments);
543-expect(command?.environment).toMatchObject({
544-TMPDIR: tmpDir,
545-OPENAI_API_KEY: apiKey,
546-});
547-expect(command?.environmentValueSources).toMatchObject({
548-TMPDIR: "file",
549-OPENAI_API_KEY: "file",
550-});
542+expect(command?.environment?.TMPDIR).toBe(tmpDir);
543+expect(command?.environment?.OPENAI_API_KEY).toBe(apiKey);
544+expect(command?.environmentValueSources?.TMPDIR).toBe("file");
545+expect(command?.environmentValueSources?.OPENAI_API_KEY).toBe("file");
551546});
552547553548it("creates the LaunchAgent TMPDIR before bootstrap", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。