test(auto-reply): import reply after harness mocks

This commit is contained in:
Peter Steinberger
2026-02-14 21:57:24 +01:00
parent bf2dc0d9c2
commit 043ae00446
14 changed files with 84 additions and 28 deletions

View File

@@ -1,7 +1,6 @@
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { getReplyFromConfig } from "./reply.js";
import { beforeAll, describe, expect, it } from "vitest";
import {
getRunEmbeddedPiAgentMock,
installTriggerHandlingE2eTestHooks,
@@ -9,6 +8,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,7 +1,6 @@
import fs from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { getReplyFromConfig } from "./reply.js";
import { beforeAll, describe, expect, it } from "vitest";
import {
getRunEmbeddedPiAgentMock,
installTriggerHandlingE2eTestHooks,
@@ -9,6 +8,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,7 +1,6 @@
import fs from "node:fs/promises";
import { describe, expect, it } from "vitest";
import { beforeAll, describe, expect, it } from "vitest";
import { loadSessionStore } from "../config/sessions.js";
import { getReplyFromConfig } from "./reply.js";
import {
installTriggerHandlingE2eTestHooks,
MAIN_SESSION_KEY,
@@ -9,6 +8,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,8 +1,7 @@
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { beforeAll, describe, expect, it } from "vitest";
import { normalizeTestText } from "../../test/helpers/normalize-text.js";
import { getReplyFromConfig } from "./reply.js";
import {
getProviderUsageMocks,
getRunEmbeddedPiAgentMock,
@@ -11,6 +10,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
const usageMocks = getProviderUsageMocks();

View File

@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest";
import { getReplyFromConfig } from "./reply.js";
import { beforeAll, describe, expect, it } from "vitest";
import {
getRunEmbeddedPiAgentMock,
installTriggerHandlingE2eTestHooks,
@@ -7,6 +6,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,7 +1,6 @@
import fs from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { getReplyFromConfig } from "./reply.js";
import { beforeAll, describe, expect, it } from "vitest";
import {
getRunEmbeddedPiAgentMock,
installTriggerHandlingE2eTestHooks,
@@ -10,6 +9,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,6 +1,5 @@
import fs from "node:fs/promises";
import { describe, expect, it } from "vitest";
import { getReplyFromConfig } from "./reply.js";
import { beforeAll, describe, expect, it } from "vitest";
import {
getRunEmbeddedPiAgentMock,
installTriggerHandlingE2eTestHooks,
@@ -10,6 +9,11 @@ import {
} from "./reply.triggers.trigger-handling.test-harness.js";
import { HEARTBEAT_TOKEN } from "./tokens.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,6 +1,5 @@
import fs from "node:fs/promises";
import { describe, expect, it } from "vitest";
import { getReplyFromConfig } from "./reply.js";
import { beforeAll, describe, expect, it } from "vitest";
import {
getRunEmbeddedPiAgentMock,
installTriggerHandlingE2eTestHooks,
@@ -9,6 +8,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,8 +1,7 @@
import fs from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { beforeAll, describe, expect, it } from "vitest";
import { resolveSessionKey } from "../config/sessions.js";
import { getReplyFromConfig } from "./reply.js";
import {
getRunEmbeddedPiAgentMock,
installTriggerHandlingE2eTestHooks,
@@ -10,6 +9,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,8 +1,7 @@
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { beforeAll, describe, expect, it } from "vitest";
import { loadSessionStore, resolveSessionKey } from "../config/sessions.js";
import { getReplyFromConfig } from "./reply.js";
import {
getCompactEmbeddedPiSessionMock,
getRunEmbeddedPiAgentMock,
@@ -11,6 +10,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,13 +1,17 @@
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { getReplyFromConfig } from "./reply.js";
import { beforeAll, describe, expect, it } from "vitest";
import {
getRunEmbeddedPiAgentMock,
installTriggerHandlingE2eTestHooks,
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,6 +1,5 @@
import { describe, expect, it } from "vitest";
import { beforeAll, describe, expect, it } from "vitest";
import { normalizeTestText } from "../../test/helpers/normalize-text.js";
import { getReplyFromConfig } from "./reply.js";
import {
getRunEmbeddedPiAgentMock,
installTriggerHandlingE2eTestHooks,
@@ -8,6 +7,11 @@ import {
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,13 +1,17 @@
import { describe, expect, it } from "vitest";
import { beforeAll, describe, expect, it } from "vitest";
import { normalizeTestText } from "../../test/helpers/normalize-text.js";
import { loadSessionStore } from "../config/sessions.js";
import { getReplyFromConfig } from "./reply.js";
import {
installTriggerHandlingE2eTestHooks,
makeCfg,
withTempHome,
} from "./reply.triggers.trigger-handling.test-harness.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {

View File

@@ -1,8 +1,7 @@
import fs from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { beforeAll, describe, expect, it } from "vitest";
import { loadSessionStore } from "../config/sessions.js";
import { getReplyFromConfig } from "./reply.js";
import {
getAbortEmbeddedPiRunMock,
getRunEmbeddedPiAgentMock,
@@ -13,6 +12,11 @@ import {
} from "./reply.triggers.trigger-handling.test-harness.js";
import { enqueueFollowupRun, getFollowupQueueDepth, type FollowupRun } from "./reply/queue.js";
let getReplyFromConfig: typeof import("./reply.js").getReplyFromConfig;
beforeAll(async () => {
({ getReplyFromConfig } = await import("./reply.js"));
});
installTriggerHandlingE2eTestHooks();
describe("trigger handling", () => {