We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2312168 commit 21f0b6eCopy full SHA for 21f0b6e
src/setupTests.ts
@@ -1,6 +1,27 @@
1
+import { TextDecoder, TextEncoder } from 'util';
2
import '@testing-library/jest-dom';
3
import { outdent } from 'outdent';
4
5
+/**
6
+ * Polyfill TextEncoder/TextDecoder for ReactDOM
7
+ *
8
+ * @see {@link https://github.com/jsdom/jsdom/issues/1695}
9
+ */
10
+Object.defineProperties(window, {
11
+ TextEncoder: {
12
+ value: TextEncoder,
13
+ configurable: true,
14
+ enumerable: false,
15
+ writable: true,
16
+ },
17
+ TextDecoder: {
18
+ value: TextDecoder,
19
20
21
22
23
+});
24
+
25
/**
26
* Polyfill Element methods for NHS.UK frontend error summary
27
*
0 commit comments