Skip to content

Commit 55f2d82

Browse files
committed
Add workaround for Intl.NumberFormat mysteriously undefined in unit tests
1 parent b535cb5 commit 55f2d82

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
import { afterEach } from 'vitest';
1+
import { afterEach, beforeEach } from 'vitest';
22
import { cleanup } from '@testing-library/react';
33
import '@testing-library/jest-dom/vitest';
44
import 'vitest-canvas-mock';
55

6+
// Workaround for a bug in Vitest 3 or happy-dom
7+
const IntlNumberFormat = Intl.NumberFormat;
8+
9+
beforeEach(() => {
10+
Intl.NumberFormat = IntlNumberFormat;
11+
});
12+
613
afterEach(() => {
714
cleanup();
815
});

0 commit comments

Comments
 (0)