






















@@ -478,7 +478,7 @@ describe("update-cli", () => {
478478force: true,
479479json: undefined,
480480});
481-expect(runDaemonRestart).toHaveBeenCalled();
481+expect(runDaemonRestart).toHaveBeenCalledTimes(1);
482482};
483483484484const setupNonInteractiveDowngrade = async () => {
@@ -880,8 +880,8 @@ describe("update-cli", () => {
880880await updateCommand({ yes: true, tag: "2026.4.10", restart: false });
881881882882expect(spawn).not.toHaveBeenCalled();
883-expect(syncPluginsForUpdateChannel).toHaveBeenCalled();
884-expect(updateNpmInstalledPlugins).toHaveBeenCalled();
883+expect(syncPluginsForUpdateChannel).toHaveBeenCalledTimes(1);
884+expect(updateNpmInstalledPlugins).toHaveBeenCalledTimes(1);
885885expect(runDaemonInstall).not.toHaveBeenCalled();
886886expect(probeGateway).not.toHaveBeenCalled();
887887expect(defaultRuntime.exit).not.toHaveBeenCalledWith(1);
@@ -1576,7 +1576,7 @@ describe("update-cli", () => {
15761576}
1577157715781578if (expectedPersistedChannel !== undefined) {
1579-expect(replaceConfigFile).toHaveBeenCalled();
1579+expect(replaceConfigFile).toHaveBeenCalledTimes(1);
15801580const writeCall = vi.mocked(replaceConfigFile).mock.calls[0]?.[0] as
15811581| { nextConfig?: { update?: { channel?: string } } }
15821582| undefined;
@@ -1619,7 +1619,7 @@ describe("update-cli", () => {
16191619([argv]) => Array.isArray(argv) && argv[0] === "npm" && argv[1] === "i" && argv[2] === "-g",
16201620);
16211621expect(installCalls).toHaveLength(1);
1622-expect(updateNpmInstalledPlugins).toHaveBeenCalled();
1622+expect(updateNpmInstalledPlugins).toHaveBeenCalledTimes(1);
16231623expect(replaceConfigFile).not.toHaveBeenCalled();
16241624const logs = vi.mocked(defaultRuntime.log).mock.calls.map((call) => String(call[0]));
16251625expect(logs.join("\n")).not.toContain("already-current");
@@ -2914,7 +2914,7 @@ describe("update-cli", () => {
29142914force: true,
29152915json: undefined,
29162916});
2917-expect(runRestartScript).toHaveBeenCalled();
2917+expect(runRestartScript).toHaveBeenCalledTimes(1);
29182918expect(runDaemonRestart).not.toHaveBeenCalled();
29192919},
29202920},
@@ -2929,7 +2929,7 @@ describe("update-cli", () => {
29292929force: true,
29302930json: undefined,
29312931});
2932-expect(runDaemonRestart).toHaveBeenCalled();
2932+expect(runDaemonRestart).toHaveBeenCalledTimes(1);
29332933},
29342934},
29352935{
@@ -2943,7 +2943,7 @@ describe("update-cli", () => {
29432943force: true,
29442944json: undefined,
29452945});
2946-expect(runDaemonRestart).toHaveBeenCalled();
2946+expect(runDaemonRestart).toHaveBeenCalledTimes(1);
29472947},
29482948},
29492949{
@@ -3143,7 +3143,7 @@ describe("update-cli", () => {
3143314331443144await updateCommand({ yes: true });
314531453146-expect(runRestartScript).toHaveBeenCalled();
3146+expect(runRestartScript).toHaveBeenCalledTimes(1);
31473147const probeCall = probeGateway.mock.calls[0]?.[0] as { includeDetails?: boolean } | undefined;
31483148expect(probeCall?.includeDetails).toBe(true);
31493149expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
@@ -3163,7 +3163,7 @@ describe("update-cli", () => {
31633163},
31643164assertExtra: () => {
31653165expect(runDaemonInstall).not.toHaveBeenCalled();
3166-expect(runRestartScript).toHaveBeenCalled();
3166+expect(runRestartScript).toHaveBeenCalledTimes(1);
31673167},
31683168},
31693169{
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。