




















@@ -359,7 +359,7 @@ describe("update-cli", () => {
359359};
360360361361const expectUpdateCallChannel = (channel: string) => {
362-const call = vi.mocked(runGatewayUpdate).mock.calls[0]?.[0];
362+const call = vi.mocked(runGatewayUpdate).mock.calls.at(0)?.[0];
363363expect(call?.channel).toBe(channel);
364364return call;
365365};
@@ -851,7 +851,7 @@ describe("update-cli", () => {
851851},
852852);
853853854-const spawnEnv = (spawn.mock.calls[0]?.[2] as { env?: NodeJS.ProcessEnv } | undefined)?.env;
854+const spawnEnv = (spawn.mock.calls.at(0)?.[2] as { env?: NodeJS.ProcessEnv } | undefined)?.env;
855855expect(spawnEnv?.OPENCLAW_SERVICE_MARKER).toBeUndefined();
856856expect(spawnEnv?.OPENCLAW_SERVICE_KIND).toBeUndefined();
857857});
@@ -1193,7 +1193,7 @@ describe("update-cli", () => {
11931193},
11941194);
119511951196-const updateCall = updateNpmInstalledPlugins.mock.calls[0]?.[0] as
1196+const updateCall = updateNpmInstalledPlugins.mock.calls.at(0)?.[0] as
11971197| {
11981198onIntegrityDrift?: (drift: {
11991199pluginId: string;
@@ -1670,7 +1670,7 @@ describe("update-cli", () => {
1670167016711671if (expectedPersistedChannel !== undefined) {
16721672expect(replaceConfigFile).toHaveBeenCalledTimes(1);
1673-const writeCall = vi.mocked(replaceConfigFile).mock.calls[0]?.[0] as
1673+const writeCall = vi.mocked(replaceConfigFile).mock.calls.at(0)?.[0] as
16741674| { nextConfig?: { update?: { channel?: string } } }
16751675| undefined;
16761676expect(writeCall?.nextConfig?.update?.channel).toBe(expectedPersistedChannel);
@@ -2222,7 +2222,7 @@ describe("update-cli", () => {
22222222);
22232223const npmInstallCallOrder =
22242224vi.mocked(runCommandWithTimeout).mock.invocationCallOrder[npmInstallCallIndex];
2225-const serviceStopCall = serviceStop.mock.calls[0]?.[0] as
2225+const serviceStopCall = serviceStop.mock.calls.at(0)?.[0] as
22262226| { env?: NodeJS.ProcessEnv }
22272227| undefined;
22282228expect(serviceStopCall?.env?.OPENCLAW_SERVICE_MARKER).toBe("openclaw");
@@ -2678,7 +2678,7 @@ describe("update-cli", () => {
26782678await updateCommand({ channel: "beta", yes: true });
2679267926802680const repairCall =
2681-legacyConfigRepairMocks.repairLegacyConfigForUpdateChannel.mock.calls[0]?.[0];
2681+legacyConfigRepairMocks.repairLegacyConfigForUpdateChannel.mock.calls.at(0)?.[0];
26822682expect(repairCall?.configSnapshot.hash).toBe("legacy-hash");
26832683expect(repairCall?.configSnapshot.valid).toBe(false);
26842684expect(repairCall?.jsonMode).toBe(false);
@@ -2894,10 +2894,10 @@ describe("update-cli", () => {
2894289428952895await updateCommand({ channel: "beta", yes: true });
289628962897-const syncConfig = vi.mocked(syncPluginsForUpdateChannel).mock.calls[0]?.[0]?.config as
2897+const syncConfig = vi.mocked(syncPluginsForUpdateChannel).mock.calls.at(0)?.[0]?.config as
28982898| OpenClawConfig
28992899| undefined;
2900-const updateCall = vi.mocked(updateNpmInstalledPlugins).mock.calls[0]?.[0] as
2900+const updateCall = vi.mocked(updateNpmInstalledPlugins).mock.calls.at(0)?.[0] as
29012901| { skipDisabledPlugins?: boolean; syncOfficialPluginInstalls?: boolean }
29022902| undefined;
29032903expect(syncConfig?.plugins?.installs).toEqual(pluginInstallRecords);
@@ -2948,7 +2948,7 @@ describe("update-cli", () => {
2948294829492949await updateCommand({ channel: "dev", yes: true, restart: false });
295029502951-const persistedConfig = vi.mocked(replaceConfigFile).mock.calls[0]?.[0]?.nextConfig;
2951+const persistedConfig = vi.mocked(replaceConfigFile).mock.calls.at(0)?.[0]?.nextConfig;
29522952expect(persistedConfig?.update?.channel).toBe("dev");
29532953const syncCall = syncPluginCall() as
29542954| { channel?: string; config?: OpenClawConfig; workspaceDir?: string }
@@ -3130,7 +3130,9 @@ describe("update-cli", () => {
31303130expect(restartCall?.[0].slice(1)).toEqual([updatedEntrypoint, "gateway", "restart", "--json"]);
31313131expect(restartCall?.[1].cwd).toBe(updatedRoot);
31323132expect(restartCall?.[1].timeoutMs).toBe(60_000);
3133-const probeCall = probeGateway.mock.calls[0]?.[0] as { includeDetails?: boolean } | undefined;
3133+const probeCall = probeGateway.mock.calls.at(0)?.[0] as
3134+| { includeDetails?: boolean }
3135+| undefined;
31343136expect(probeCall?.includeDetails).toBe(true);
31353137expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
31363138expect(defaultRuntime.writeJson).not.toHaveBeenCalled();
@@ -3185,7 +3187,9 @@ describe("update-cli", () => {
31853187expect(installCall?.[1].timeoutMs).toBe(60_000);
31863188expect(gatewayCommandCall(updatedEntrypoint, "restart")).toBeUndefined();
31873189expect(runRestartScript).not.toHaveBeenCalled();
3188-const probeCall = probeGateway.mock.calls[0]?.[0] as { includeDetails?: boolean } | undefined;
3190+const probeCall = probeGateway.mock.calls.at(0)?.[0] as
3191+| { includeDetails?: boolean }
3192+| undefined;
31893193expect(probeCall?.includeDetails).toBe(true);
31903194expect(defaultRuntime.exit).not.toHaveBeenCalledWith(1);
31913195});
@@ -3237,7 +3241,9 @@ describe("update-cli", () => {
32373241await updateCommand({ yes: true });
3238324232393243expect(runRestartScript).toHaveBeenCalledTimes(1);
3240-const probeCall = probeGateway.mock.calls[0]?.[0] as { includeDetails?: boolean } | undefined;
3244+const probeCall = probeGateway.mock.calls.at(0)?.[0] as
3245+| { includeDetails?: boolean }
3246+| undefined;
32413247expect(probeCall?.includeDetails).toBe(true);
32423248expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
32433249expect(
@@ -3328,7 +3334,7 @@ describe("update-cli", () => {
33283334const runCommandWithTimeoutMock = vi.mocked(runCommandWithTimeout) as unknown as {
33293335mock: { calls: Array<[unknown, { cwd?: string }?]> };
33303336};
3331-const root = setup?.root ?? runCommandWithTimeoutMock.mock.calls[0]?.[1]?.cwd;
3337+const root = setup?.root ?? runCommandWithTimeoutMock.mock.calls.at(0)?.[1]?.cwd;
33323338const entryPath = setup?.entrypoints?.[0] ?? path.join(String(root), "dist", "entry.js");
3333333933343340const installCall = gatewayCommandCall(entryPath, "install");
@@ -3355,7 +3361,7 @@ describe("update-cli", () => {
3355336133563362await updateCommand({});
335733633358-const doctorCall = vi.mocked(doctorCommand).mock.calls[0];
3364+const doctorCall = vi.mocked(doctorCommand).mock.calls.at(0);
33593365expect(doctorCall?.[0]).toBe(defaultRuntime);
33603366expect(doctorCall?.[1]?.nonInteractive).toBe(true);
33613367expect(process.env.OPENCLAW_UPDATE_IN_PROGRESS).toBeUndefined();
@@ -3473,7 +3479,7 @@ describe("update-cli", () => {
3473347934743480await updateWizardCommand({});
347534813476-const call = vi.mocked(runGatewayUpdate).mock.calls[0]?.[0];
3482+const call = vi.mocked(runGatewayUpdate).mock.calls.at(0)?.[0];
34773483expect(call?.channel).toBe("dev");
34783484});
34793485});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。