






















@@ -152,7 +152,16 @@ describe("update-startup", () => {
152152}
153153154154async function expectPathMissing(targetPath: string): Promise<void> {
155-await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" });
155+let statError: NodeJS.ErrnoException | undefined;
156+try {
157+await fs.stat(targetPath);
158+} catch (error) {
159+statError = error as NodeJS.ErrnoException;
160+}
161+expect(statError).toBeInstanceOf(Error);
162+expect(statError?.code).toBe("ENOENT");
163+expect(statError?.path).toBe(targetPath);
164+expect(statError?.syscall).toBe("stat");
156165}
157166158167function createAutoUpdateSuccessMock() {
@@ -390,13 +399,16 @@ describe("update-startup", () => {
390399});
391400392401expect(runAutoUpdate).not.toHaveBeenCalled();
393-expect(log.info).toHaveBeenCalledWith(
402+const disabledLogCall = log.info.mock.calls.find(
403+([message]) => message === "auto-update disabled by OPENCLAW_NO_AUTO_UPDATE",
404+);
405+expect(disabledLogCall).toEqual([
394406"auto-update disabled by OPENCLAW_NO_AUTO_UPDATE",
395-expect.objectContaining({
407+{
396408version: "2.0.0-beta.1",
397409tag: "beta",
398-}),
399-);
410+},
411+]);
400412});
401413402414it("uses current runtime + entrypoint for default auto-update command execution", async () => {
@@ -421,23 +433,23 @@ describe("update-startup", () => {
421433process.argv = originalArgv;
422434}
423435424-expect(runCommandWithTimeout).toHaveBeenCalledWith(
425- [
426- process.execPath,
427- "/opt/openclaw/dist/entry.js",
428- "update",
429- "--yes",
430- "--channel",
431- "beta",
432- "--json",
433-],
434- expect.objectContaining({
435- timeoutMs: 45 * 60 * 1000,
436- env: expect.objectContaining({
437- OPENCLAW_AUTO_UPDATE: "1",
438-}),
439-}),
440-);
436+expect(runCommandWithTimeout).toHaveBeenCalledTimes(1);
437+const [argv, options] = vi.mocked(runCommandWithTimeout).mock.calls[0] ?? [];
438+expect(argv).toEqual([
439+process.execPath,
440+"/opt/openclaw/dist/entry.js",
441+"update",
442+"--yes",
443+"--channel",
444+"beta",
445+"--json",
446+]);
447+expect(options).toEqual({
448+timeoutMs: 45 * 60 * 1000,
449+env: {
450+OPENCLAW_AUTO_UPDATE: "1",
451+},
452+});
441453});
442454443455it("scheduleGatewayUpdateCheck returns a cleanup function", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。