test: move telegram fetch coverage into extensions

This commit is contained in:
Peter Steinberger
2026-04-03 11:35:07 +01:00
parent e0c4458a2f
commit bb3ea2137b
9 changed files with 132 additions and 369 deletions

View File

@@ -106,10 +106,6 @@
"file": "extensions/telegram/src/bot.test.ts",
"reason": "This Telegram bot runtime suite measured ~819.9 MiB RSS growth locally; keep it in its own forked channel lane so the shared channels worker can recycle immediately after the hotspot file."
},
{
"file": "extensions/telegram/src/fetch.test.ts",
"reason": "This Telegram transport suite measured ~759.3 MiB RSS growth locally; keep it in its own forked channel lane so the shared channels worker can recycle immediately after the hotspot file."
},
{
"file": "extensions/telegram/src/sendchataction-401-backoff.test.ts",
"reason": "This Telegram send-chat-action backoff suite hoists infra-runtime sleep mocks and remains a relatively heavy shared hotspot; keep it isolated so top-level concurrency can overlap it instead of extending the shared channels batch."
@@ -210,6 +206,10 @@
"file": "extensions/line/src/send.test.ts",
"reason": "This LINE send suite hoists SDK and account/token mocks; keep it isolated so shared extension workers do not reuse cached send modules that bypass those mocks."
},
{
"file": "extensions/telegram/src/fetch.test.ts",
"reason": "This Telegram transport suite is extension-owned and still measures high RSS locally; keep it in its own forked extensions lane so the shared worker can recycle immediately after the hotspot."
},
{
"file": "extensions/tavily/src/tavily-extract-tool.test.ts",
"reason": "This extract-tool suite hoists the Tavily client mock and imports lazily; keep it isolated so shared extension workers do not reuse cached tool modules and hit real API-key resolution."

View File

@@ -60,15 +60,9 @@
"extensions/discord/src/monitor/message-handler.queue.test.ts": {
"durationMs": 3900
},
"extensions/telegram/src/fetch.test.ts": {
"durationMs": 3500
},
"extensions/whatsapp/src/monitor-inbox.captures-media-path-image-messages.test.ts": {
"durationMs": 3200
},
"extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts": {
"durationMs": 15830
},
"extensions/telegram/src/webhook.test.ts": {
"durationMs": 2900
},

View File

@@ -1047,9 +1047,13 @@
"durationMs": 2.155517578125,
"testCount": 5
},
"extensions/telegram/src/fetch.network-policy.test.ts": {
"durationMs": 3260,
"testCount": 5
"extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts": {
"durationMs": 10360,
"testCount": 27
},
"extensions/telegram/src/fetch.test.ts": {
"durationMs": 750,
"testCount": 23
}
}
}

View File

@@ -447,14 +447,14 @@ describe("scripts/test-parallel lane planning", () => {
expect(output).not.toContain("vitest.unit.config.ts");
});
it("routes telegram fetch network policy through the extensions config", () => {
it("routes telegram fetch transport coverage through the extensions config", () => {
const output = runPlannerPlan([
"--explain",
bundledPluginFile("telegram", "src/fetch.network-policy.test.ts"),
bundledPluginFile("telegram", "src/fetch.test.ts"),
]);
expect(output).toContain("surface=extensions");
expect(output).toContain("reasons=extensions-surface");
expect(output).toContain("extensions-surface");
expect(output).toContain("vitest.extensions.config.ts");
expect(output).not.toContain("vitest.channels.config.ts");
});

View File

@@ -48,6 +48,15 @@ describe("createScopedVitestConfig", () => {
expect(config.test?.include).toEqual(["**/*.test.ts"]);
expect(config.test?.exclude).toEqual(expect.arrayContaining(["channel/**", "dist/**"]));
});
it("overrides setup files when a scoped config requests them", () => {
const config = createScopedVitestConfig(["src/example.test.ts"], {
env: {},
setupFiles: ["test/setup.extensions.ts"],
});
expect(config.test?.setupFiles).toEqual(["test/setup.extensions.ts"]);
});
});
describe("scoped vitest configs", () => {
@@ -97,19 +106,23 @@ describe("scoped vitest configs", () => {
expect(defaultExtensionsConfig.test?.include).toEqual(["**/*.test.ts"]);
});
it("keeps telegram fetch network policy in extensions while excluding other telegram channel suites", () => {
it("keeps telegram fetch transport coverage in extensions while excluding other telegram channel suites", () => {
const extensionExcludes = defaultExtensionsConfig.test?.exclude ?? [];
expect(
extensionExcludes.some((pattern) => path.matchesGlob("telegram/src/fetch.test.ts", pattern)),
).toBe(true);
).toBe(false);
expect(
extensionExcludes.some((pattern) =>
path.matchesGlob("telegram/src/fetch.network-policy.test.ts", pattern),
path.matchesGlob("telegram/src/bot/delivery.resolve-media-retry.test.ts", pattern),
),
).toBe(false);
expect(defaultChannelsConfig.test?.exclude).toContain(
bundledPluginFile("telegram", "src/fetch.network-policy.test.ts"),
bundledPluginFile("telegram", "src/fetch.test.ts"),
);
expect(defaultChannelsConfig.test?.exclude).toContain(
bundledPluginFile("telegram", "src/bot/delivery.resolve-media-retry.test.ts"),
);
expect(defaultExtensionsConfig.test?.setupFiles).toEqual(["test/setup.extensions.ts"]);
});
it("normalizes gateway include patterns relative to the scoped dir", () => {