diff --git a/extensions/discord/src/channel-actions.test.ts b/extensions/discord/src/channel-actions.test.ts index e6c080e494c..8c68b57d5b7 100644 --- a/extensions/discord/src/channel-actions.test.ts +++ b/extensions/discord/src/channel-actions.test.ts @@ -1,5 +1,6 @@ -import { describe, expect, it, vi } from "vitest"; +import type { ChannelMessageActionContext } from "openclaw/plugin-sdk/channel-contract"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; +import { describe, expect, it, vi } from "vitest"; const handleDiscordMessageActionMock = vi.hoisted(() => vi.fn(async () => ({ ok: true }))); @@ -49,14 +50,7 @@ describe("discordMessageActions", () => { expect(discovery?.capabilities).toEqual(["interactive", "components"]); expect(discovery?.schema).not.toBeNull(); expect(discovery?.actions).toEqual( - expect.arrayContaining([ - "send", - "poll", - "react", - "reactions", - "emoji-list", - "permissions", - ]), + expect.arrayContaining(["send", "poll", "react", "reactions", "emoji-list", "permissions"]), ); expect(discovery?.actions).not.toContain("channel-create"); expect(discovery?.actions).not.toContain("role-add"); @@ -90,10 +84,13 @@ describe("discordMessageActions", () => { }, }, } as OpenClawConfig; - const toolContext = { sessionId: "s1" }; + const toolContext: ChannelMessageActionContext["toolContext"] = { + currentChannelProvider: "discord", + }; const mediaLocalRoots = ["/tmp/media"]; await discordMessageActions.handleAction?.({ + channel: "discord", action: "send", params: { to: "channel:123", text: "hello" }, cfg, diff --git a/extensions/discord/src/draft-chunking.test.ts b/extensions/discord/src/draft-chunking.test.ts index 8141ea0d0b9..b593fcd6532 100644 --- a/extensions/discord/src/draft-chunking.test.ts +++ b/extensions/discord/src/draft-chunking.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it } from "vitest"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; +import { describe, expect, it } from "vitest"; import { resolveDiscordDraftStreamingChunking } from "./draft-chunking.js"; describe("resolveDiscordDraftStreamingChunking", () => { diff --git a/extensions/discord/src/draft-stream.test.ts b/extensions/discord/src/draft-stream.test.ts index 2f0854c71b2..ee4febef744 100644 --- a/extensions/discord/src/draft-stream.test.ts +++ b/extensions/discord/src/draft-stream.test.ts @@ -75,9 +75,7 @@ describe("createDiscordDraftStream", () => { await stream.flush(); expect(rest.post).not.toHaveBeenCalled(); - expect(warn).toHaveBeenCalledWith( - expect.stringContaining("discord stream preview stopped"), - ); + expect(warn).toHaveBeenCalledWith(expect.stringContaining("discord stream preview stopped")); expect(stream.messageId()).toBeUndefined(); }); }); diff --git a/extensions/discord/src/status-issues.test.ts b/extensions/discord/src/status-issues.test.ts index 162b8dc6c64..d23ce0c46bd 100644 --- a/extensions/discord/src/status-issues.test.ts +++ b/extensions/discord/src/status-issues.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it } from "vitest"; import type { ChannelAccountSnapshot } from "openclaw/plugin-sdk/channel-contract"; +import { describe, expect, it } from "vitest"; import { collectDiscordStatusIssues } from "./status-issues.js"; describe("collectDiscordStatusIssues", () => { diff --git a/extensions/telegram/src/allowed-updates.test.ts b/extensions/telegram/src/allowed-updates.test.ts index 269f45524fa..cc237d32f13 100644 --- a/extensions/telegram/src/allowed-updates.test.ts +++ b/extensions/telegram/src/allowed-updates.test.ts @@ -6,7 +6,7 @@ describe("resolveTelegramAllowedUpdates", () => { it("includes the default update types plus reaction and channel post support", () => { const updates = resolveTelegramAllowedUpdates(); - expect(updates).toEqual(expect.arrayContaining(API_CONSTANTS.DEFAULT_UPDATE_TYPES)); + expect(updates).toEqual(expect.arrayContaining([...API_CONSTANTS.DEFAULT_UPDATE_TYPES])); expect(updates).toContain("message_reaction"); expect(updates).toContain("channel_post"); expect(new Set(updates).size).toBe(updates.length); diff --git a/extensions/telegram/src/dm-access.test.ts b/extensions/telegram/src/dm-access.test.ts index 09a049f6d37..457aa2cd8f2 100644 --- a/extensions/telegram/src/dm-access.test.ts +++ b/extensions/telegram/src/dm-access.test.ts @@ -90,11 +90,16 @@ describe("enforceTelegramDmAccess", () => { const sendMessage = vi.fn(async () => undefined); const logger = { info: vi.fn() }; createChannelPairingChallengeIssuerMock.mockReturnValueOnce( - ({ sendPairingReply, onCreated }) => - (async () => { - onCreated(); - await sendPairingReply("Pairing code: 123456"); - })(), + async ({ + sendPairingReply, + onCreated, + }: { + sendPairingReply: (text: string) => Promise; + onCreated: () => void; + }) => { + onCreated(); + await sendPairingReply("Pairing code: 123456"); + }, ); const allowed = await enforceTelegramDmAccess({ diff --git a/extensions/telegram/src/normalize.test.ts b/extensions/telegram/src/normalize.test.ts index d5504aebd49..bbd0afbae6f 100644 --- a/extensions/telegram/src/normalize.test.ts +++ b/extensions/telegram/src/normalize.test.ts @@ -4,9 +4,7 @@ import { looksLikeTelegramTargetId, normalizeTelegramMessagingTarget } from "./n describe("telegram target normalization", () => { it("normalizes telegram prefixes, group targets, and topic suffixes", () => { expect(normalizeTelegramMessagingTarget("telegram:123456")).toBe("telegram:123456"); - expect(normalizeTelegramMessagingTarget("tg:group:-100123")).toBe( - "telegram:group:-100123", - ); + expect(normalizeTelegramMessagingTarget("tg:group:-100123")).toBe("telegram:group:-100123"); expect(normalizeTelegramMessagingTarget("telegram:-100123:topic:99")).toBe( "telegram:-100123:topic:99", ); diff --git a/extensions/telegram/src/status-issues.test.ts b/extensions/telegram/src/status-issues.test.ts index 02bbe5078bd..1788d000514 100644 --- a/extensions/telegram/src/status-issues.test.ts +++ b/extensions/telegram/src/status-issues.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it } from "vitest"; import type { ChannelAccountSnapshot } from "openclaw/plugin-sdk/channel-contract"; +import { describe, expect, it } from "vitest"; import { collectTelegramStatusIssues } from "./status-issues.js"; describe("collectTelegramStatusIssues", () => { diff --git a/scripts/check-no-conflict-markers.mjs b/scripts/check-no-conflict-markers.mjs index 2e540bfbf93..0fa95d0a0fc 100644 --- a/scripts/check-no-conflict-markers.mjs +++ b/scripts/check-no-conflict-markers.mjs @@ -3,7 +3,7 @@ import { execFileSync } from "node:child_process"; import fs from "node:fs"; import path from "node:path"; -import { runAsScript } from "./lib/ts-guard-utils.mjs"; +import { fileURLToPath } from "node:url"; function isBinaryBuffer(buffer) { return buffer.includes(0); @@ -77,4 +77,9 @@ export async function main() { process.exitCode = 1; } -runAsScript(import.meta.url, main); +if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { + main().catch((error) => { + console.error(error); + process.exit(1); + }); +}