test: make unsafe test coercion explicit

Move test coercion out of a hidden global and require each test to import the helper so review tools and runtime scripts can see the unsafe boundary.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-12 15:38:31 +09:00
parent ce5da13fc5
commit d5fbada13d
103 changed files with 700 additions and 554 deletions
+3 -2
View File
@@ -16,6 +16,7 @@ afterAll(() => { mock.restore() })
import { LSPClient, lspManager, validateCwd } from "./client"
import type { ResolvedServer } from "./types"
import { unsafeTestValue } from "../../../test-support/unsafe-test-value"
describe("LSPClient", () => {
beforeEach(async () => {
@@ -36,7 +37,7 @@ describe("LSPClient", () => {
const originalSetTimeout = globalThis.setTimeout
globalThis.setTimeout = ((fn: (...args: unknown[]) => void, _ms?: number) => {
fn()
return testCoerce<ReturnType<typeof setTimeout>>(0)
return unsafeTestValue<ReturnType<typeof setTimeout>>(0)
}) as typeof setTimeout
const server: ResolvedServer = {
@@ -50,7 +51,7 @@ describe("LSPClient", () => {
// Stub protocol output: we only want to assert notifications.
const sendNotificationSpy = spyOn(
testCoerce<{ sendNotification: (m: string, p?: unknown) => void }>(client),
unsafeTestValue<{ sendNotification: (m: string, p?: unknown) => void }>(client),
"sendNotification"
)