Skip to content

Commit baaad76

Browse files
committed
fix: mock Worker for tests
1 parent 228e2d1 commit baaad76

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

vitest.setup.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,17 @@ if (!window.matchMedia) {
1616
})),
1717
});
1818
}
19+
20+
// Mock Worker
21+
class Worker {
22+
constructor(stringUrl) {
23+
this.url = stringUrl;
24+
this.onmessage = () => { };
25+
}
26+
postMessage(msg) {
27+
this.onmessage({ data: msg });
28+
}
29+
terminate() { }
30+
}
31+
32+
global.Worker = Worker;

0 commit comments

Comments
 (0)