




















@@ -53,6 +53,19 @@ const maybeRunCliInContainerMock = vi.hoisted(() =>
5353>((argv: string[]) => ({ handled: false, argv })),
5454);
555556+function requireRunCrestodianOptions(index = 0): { onReady?: unknown } {
57+const call = runCrestodianMock.mock.calls.at(index);
58+if (!call) {
59+throw new Error(`expected runCrestodian call ${index}`);
60+}
61+expect(typeof call[0]).toBe("object");
62+expect(call[0]).not.toBeNull();
63+if (typeof call[0] !== "object" || call[0] === null) {
64+throw new Error(`expected runCrestodian call ${index} to receive options`);
65+}
66+return call[0] as { onReady?: unknown };
67+}
68+5669vi.mock("commander", () => {
5770class MockCommanderError extends Error {
5871exitCode: number;
@@ -728,7 +741,7 @@ describe("runCli exit behavior", () => {
728741729742expect(ensureGlobalUndiciEnvProxyDispatcherMock).toHaveBeenCalledTimes(1);
730743expect(runCrestodianMock).toHaveBeenCalledOnce();
731-const crestodianOptions = runCrestodianMock.mock.calls[0]?.[0] as { onReady?: unknown };
744+const crestodianOptions = requireRunCrestodianOptions();
732745expect(crestodianOptions).toEqual({ onReady: crestodianOptions.onReady });
733746expect(crestodianOptions.onReady).toBeTypeOf("function");
734747expect(ensureGlobalUndiciEnvProxyDispatcherMock.mock.invocationCallOrder[0]).toBeLessThan(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。