Skip to content

Commit ee82753

Browse files
KyleAMathewsclaude
andcommitted
fix: update ShapeStream mock constructor for vitest v4
Vitest v4 changed how mock functions work as constructors. Updated the ShapeStream mock to use mockImplementation with a regular function instead of an arrow function, allowing it to work properly with `new`. Fixes electric-db-collection test failures caused by "not a constructor" error in vitest v4. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ab2cf14 commit ee82753

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/electric-db-collection/tests/electric-live-query.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ vi.mock(`@electric-sql/client`, async () => {
6262
const actual = await vi.importActual(`@electric-sql/client`)
6363
return {
6464
...actual,
65-
ShapeStream: vi.fn(() => mockStream),
65+
ShapeStream: vi.fn().mockImplementation(function () {
66+
return mockStream
67+
}),
6668
}
6769
})
6870

packages/electric-db-collection/tests/electric.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ vi.mock(`@electric-sql/client`, async () => {
2727
const actual = await vi.importActual(`@electric-sql/client`)
2828
return {
2929
...actual,
30-
ShapeStream: vi.fn(() => mockStream),
30+
ShapeStream: vi.fn().mockImplementation(function () {
31+
return mockStream
32+
}),
3133
}
3234
})
3335

0 commit comments

Comments
 (0)