test: stabilize vitest mocks and harness typing

This commit is contained in:
Peter Steinberger
2026-02-14 20:44:46 +01:00
parent e4d63818f5
commit 5b7a33272a
14 changed files with 80 additions and 39 deletions

View File

@@ -1,8 +1,7 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, it, vi } from "vitest";
import { monitorWebChannel } from "./auto-reply.js";
import { beforeAll, describe, expect, it, vi } from "vitest";
import {
installWebAutoReplyTestHomeHooks,
installWebAutoReplyUnitTestHooks,
@@ -13,6 +12,12 @@ import {
installWebAutoReplyTestHomeHooks();
let monitorWebChannel: typeof import("./auto-reply.js").monitorWebChannel;
beforeAll(async () => {
({ monitorWebChannel } = await import("./auto-reply.js"));
});
describe("web auto-reply", () => {
installWebAutoReplyUnitTestHooks();

View File

@@ -1,9 +1,8 @@
import crypto from "node:crypto";
import fs from "node:fs/promises";
import { describe, expect, it, vi } from "vitest";
import { beforeAll, describe, expect, it, vi } from "vitest";
import { expectInboundContextContract } from "../../test/helpers/inbound-contract.js";
import { setLoggerOverride } from "../logging.js";
import { monitorWebChannel, SILENT_REPLY_TOKEN } from "./auto-reply.js";
import {
installWebAutoReplyTestHomeHooks,
installWebAutoReplyUnitTestHooks,
@@ -14,6 +13,13 @@ import {
installWebAutoReplyTestHomeHooks();
let monitorWebChannel: typeof import("./auto-reply.js").monitorWebChannel;
let SILENT_REPLY_TOKEN: typeof import("./auto-reply.js").SILENT_REPLY_TOKEN;
beforeAll(async () => {
({ monitorWebChannel, SILENT_REPLY_TOKEN } = await import("./auto-reply.js"));
});
describe("web auto-reply", () => {
installWebAutoReplyUnitTestHooks();

View File

@@ -1,5 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { monitorWebChannel } from "./auto-reply.js";
import { beforeAll, describe, expect, it, vi } from "vitest";
import {
installWebAutoReplyTestHomeHooks,
installWebAutoReplyUnitTestHooks,
@@ -9,6 +8,12 @@ import {
installWebAutoReplyTestHomeHooks();
let monitorWebChannel: typeof import("./auto-reply.js").monitorWebChannel;
beforeAll(async () => {
({ monitorWebChannel } = await import("./auto-reply.js"));
});
describe("web auto-reply", () => {
installWebAutoReplyUnitTestHooks();