Skip to content

Commit 9e6a029

Browse files
committed
Fix testing-lib fail
1 parent a64d5ad commit 9e6a029

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/node_modules/@testing-library/react/dist/@testing-library/react.esm.js b/node_modules/@testing-library/react/dist/@testing-library/react.esm.js
2+
index f25d5fb..e647f88 100644
3+
--- a/node_modules/@testing-library/react/dist/@testing-library/react.esm.js
4+
+++ b/node_modules/@testing-library/react/dist/@testing-library/react.esm.js
5+
@@ -31,15 +31,17 @@ try {
6+
// we can't use regular timers because they may still be faked
7+
// so we try MessageChannel+postMessage instead
8+
enqueueTask = function (callback) {
9+
- if (didWarnAboutMessageChannel === false) {
10+
+ const supportsMessageChannel = typeof MessageChannel === 'function';
11+
+ if (supportsMessageChannel) {
12+
+ var channel = new MessageChannel();
13+
+ channel.port1.onmessage = callback;
14+
+ channel.port2.postMessage(undefined);
15+
+ } else if (didWarnAboutMessageChannel === false) {
16+
didWarnAboutMessageChannel = true; // eslint-disable-next-line no-console
17+
18+
- console.error(typeof MessageChannel !== 'undefined', 'This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
19+
+ console.error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
20+
}
21+
22+
- var channel = new MessageChannel();
23+
- channel.port1.onmessage = callback;
24+
- channel.port2.postMessage(undefined);
25+
};
26+
}
27+

0 commit comments

Comments
 (0)