test(core): reduce mock reset overhead across unit and e2e specs

This commit is contained in:
Peter Steinberger
2026-02-22 08:22:52 +00:00
parent d06ad6bc55
commit 8a0a28763e
13 changed files with 13 additions and 13 deletions

View File

@@ -39,7 +39,7 @@ function mockNodeList(commands?: string[]) {
}
beforeEach(() => {
callGateway.mockReset();
callGateway.mockClear();
});
describe("nodes camera_snap", () => {

View File

@@ -26,7 +26,7 @@ function createSandbox(overrides?: Partial<SandboxContext>): SandboxContext {
describe("sandbox fs bridge shell compatibility", () => {
beforeEach(() => {
mockedExecDockerRaw.mockReset();
mockedExecDockerRaw.mockClear();
mockedExecDockerRaw.mockImplementation(async (args) => {
const script = args[5] ?? "";
if (script.includes('stat -c "%F|%s|%Y"')) {

View File

@@ -32,7 +32,7 @@ describe("sessions_spawn requesterOrigin threading", () => {
beforeEach(() => {
const callGatewayMock = getCallGatewayMock();
resetSubagentRegistryForTests();
callGatewayMock.mockReset();
callGatewayMock.mockClear();
setSessionsSpawnConfigOverride({
session: {
mainKey: "main",

View File

@@ -42,7 +42,7 @@ describe("emitSubagentEndedHookOnce", () => {
};
beforeEach(() => {
lifecycleMocks.getGlobalHookRunner.mockReset();
lifecycleMocks.getGlobalHookRunner.mockClear();
lifecycleMocks.runSubagentEnded.mockClear();
});

View File

@@ -70,7 +70,7 @@ describe("announce loop guard (#18264)", () => {
afterEach(() => {
vi.useRealTimers();
loadSubagentRegistryFromDisk.mockReset();
loadSubagentRegistryFromDisk.mockClear();
loadSubagentRegistryFromDisk.mockReturnValue(new Map());
saveSubagentRegistryToDisk.mockClear();
vi.clearAllMocks();

View File

@@ -9,7 +9,7 @@ import { readLatestAssistantReply } from "./agent-step.js";
describe("readLatestAssistantReply", () => {
beforeEach(() => {
callGatewayMock.mockReset();
callGatewayMock.mockClear();
});
it("returns the most recent assistant message when compaction markers trail history", async () => {

View File

@@ -12,7 +12,7 @@ import { createCronTool } from "./cron-tool.js";
describe("cron tool flat-params", () => {
beforeEach(() => {
callGatewayToolMock.mockReset();
callGatewayToolMock.mockClear();
callGatewayToolMock.mockResolvedValue({ ok: true });
});