


























@@ -141,9 +141,8 @@ describe("loadChannelConfigSurfaceModule", () => {
141141typeof import("../../scripts/load-channel-config-surface.ts")
142142>(import.meta.url, "../../scripts/load-channel-config-surface.ts?scope=prefer-jiti");
143143144-await expect(
145-imported.loadChannelConfigSurfaceModule(modulePath, { repoRoot }),
146-).resolves.toMatchObject(expectedOkSchema("string"));
144+const surface = await imported.loadChannelConfigSurfaceModule(modulePath, { repoRoot });
145+expect(surface).toStrictEqual(expectedOkSchema("string"));
147146expect(spawnSync).not.toHaveBeenCalled();
148147} finally {
149148vi.doUnmock("node:child_process");
@@ -158,9 +157,8 @@ describe("loadChannelConfigSurfaceModule", () => {
158157const { loadChannelConfigSurfaceModule: loadWithMissingBun, spawnSync } =
159158await importLoaderWithMissingBun();
160159161-await expect(loadWithMissingBun(modulePath, { repoRoot })).resolves.toMatchObject(
162-expectedOkSchema("string"),
163-);
160+const surface = await loadWithMissingBun(modulePath, { repoRoot });
161+expect(surface).toStrictEqual(expectedOkSchema("string"));
164162expect(spawnSync).not.toHaveBeenCalled();
165163});
166164});
@@ -172,10 +170,16 @@ describe("loadChannelConfigSurfaceModule", () => {
172170const { loadChannelConfigSurfaceModule: loadWithFailingJiti, spawnSync } =
173171await importLoaderWithFailingJitiAndWorkingBun();
174172175-await expect(loadWithFailingJiti(modulePath, { repoRoot })).resolves.toMatchObject(
176-expectedOkSchema("number"),
177-);
178-expect(spawnSync).toHaveBeenCalledWith("bun", expect.any(Array), expect.any(Object));
173+const surface = await loadWithFailingJiti(modulePath, { repoRoot });
174+expect(surface).toStrictEqual(expectedOkSchema("number"));
175+176+const spawnCalls = spawnSync.mock.calls as unknown as Array<
177+[string, string[], Record<string, unknown>]
178+>;
179+const spawnCall = spawnCalls[0];
180+expect(spawnCall?.[0]).toBe("bun");
181+expect(Array.isArray(spawnCall?.[1])).toBe(true);
182+expect(typeof spawnCall?.[2]).toBe("object");
179183});
180184});
181185});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。