Skip to content

Commit 7663ab3

Browse files
committed
fix(hygiene): handle TypeScript generics in importActual regex and fix suppression placement
1 parent df33c79 commit 7663ab3

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

apps/sim/lib/copilot/request/go/stream.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
MothershipStreamV1ToolPhase,
1212
} from '@/lib/copilot/generated/mothership-stream-v1'
1313

14-
// hygiene-suppress: session re-exports many real domain functions (eventToStreamEvent, parsePersistedStreamEventEnvelope) used by stream.ts under test — must spread real implementations and override only hasAbortMarker
1514
vi.mock('@/lib/copilot/request/session', async () => {
15+
// hygiene-suppress: session re-exports real domain functions (eventToStreamEvent, parsePersistedStreamEventEnvelope) used by stream.ts under test — must spread real implementations and override only hasAbortMarker
1616
const actual = await vi.importActual<typeof import('@/lib/copilot/request/session')>(
1717
'@/lib/copilot/request/session'
1818
)

scripts/check-hygiene.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const VITEST_ANTI_PATTERNS: Array<{ pattern: RegExp; description: string }> = [
158158
'vi.resetModules() — use vi.hoisted() + vi.mock() + static imports instead (exception: singleton modules that cache state)',
159159
},
160160
{
161-
pattern: /\bvi\.importActual\s*\(/,
161+
pattern: /\bvi\.importActual\s*(?:<[^>]*>)?\s*\(/,
162162
description: 'vi.importActual() — mock everything explicitly instead',
163163
},
164164
]

0 commit comments

Comments
 (0)