






















@@ -466,7 +466,7 @@ describe("gateway hot reload", () => {
466466hoisted.providerManager.startChannel.mockClear();
467467hoisted.activeEmbeddedRunCount.value = 1;
468468embeddedRunMock.activeIds.add("reload-active");
469-const delay = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
469+vi.useFakeTimers();
470470const reloadPromise = onHotReload?.(
471471{
472472changedPaths: ["channels.discord.token"],
@@ -486,16 +486,20 @@ describe("gateway hot reload", () => {
486486},
487487);
488488try {
489-await delay(550);
489+await Promise.resolve();
490+await vi.advanceTimersByTimeAsync(500);
490491expect(hoisted.providerManager.stopChannel).not.toHaveBeenCalled();
491492expect(hoisted.providerManager.startChannel).not.toHaveBeenCalled();
492493493494hoisted.activeEmbeddedRunCount.value = 0;
494495embeddedRunMock.activeIds.clear();
496+await vi.advanceTimersByTimeAsync(500);
495497await reloadPromise;
496498} finally {
497499hoisted.activeEmbeddedRunCount.value = 0;
498500embeddedRunMock.activeIds.clear();
501+await vi.advanceTimersByTimeAsync(500).catch(() => {});
502+vi.useRealTimers();
499503await reloadPromise?.catch(() => {});
500504}
501505此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。