-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difference between Node 14 and Node 16 in the basic example #1054
Comments
We've recently noted the same issue with Node 16 & 18. It seems to be similar to the issue #1007 reported by other users, for which we didn't have repro earlier. We'll be looking to find root cause for this and provide a fix. @jensdev do you have some spare time and interest to help us investigate this issue? |
It seems to be caused by the The following also seems to do the trick delete global.MessageChannel; or using the jsdom test environment also works ( https://github.com/facebook/jest/pull/12581/files ) but needs to be installed separately for jest 28. https://jestjs.io/docs/upgrading-to-jest28#jsdom |
RNTL = React Native Testing Library https://callstack.github.io/react-native-testing-library/ We explicitly require Node 14 because of the issue described here: callstack/react-native-testing-library#1054
@jensdev thanks for investigating the topic! Great job! 💯 I've checked that this behaviour seems to be fixed in React 18 (Expo 46). If anyone needs to stay on React 17 then Dan Abramov created a small fix package that does the npm install react-16-node-hanging-test-fix |
@mdjastrzebski Thanks for the cross-reference above. I was wondering why I had open handles pointing at While we still use React 17.0.2, the above library worked like a charm...once I patched its version condition diff --git a/node_modules/react-16-node-hanging-test-fix/index.js b/node_modules/react-16-node-hanging-test-fix/index.js
index 4a3b342..f15b540 100644
--- a/node_modules/react-16-node-hanging-test-fix/index.js
+++ b/node_modules/react-16-node-hanging-test-fix/index.js
@@ -16,7 +16,9 @@ if (Object.prototype.toString.call(process) !== '[object process]') {
);
}
-if (semverGt(version, '17.0.1')) {
+// NOTE: Patching the application boundary to 17.0.2, as
+// the actual fix will only become available in React 18
+if (semverGt(version, '17.0.2')) {
console.error(
'The `react-16-node-hanging-test-fix` package is no longer needed ' +
'with React ' + version + ' and may cause issues. Remove this import.' |
So, we just upgraded a project using the
to
Based on the initial sem ver scope and discussions, we thought we could remove So 🤔 |
@tomwanzek hmmm, I haven't observed that before. Would you be able to submit a minimal reproduction repo for this issue? Perhaps if we are able to reproduce it locally we could advise something. If so, pls use examples/basic as a base for such repo. |
my team are on the same boat, except we are still using enzyme (planning on rt test lib at some point). But basically, getting this open handle error message port error. I did what you just recommended and it fixes the issue. Which is ironic, because it throws a console error:
My testing is working, so i'm keeping it for the time being, thanks. the issue is obviously persisting regardless of what has been claimed |
@tomwanzek @alfergus0n BTW the whole "patch" of that package is just:
https://www.npmjs.com/package/react-16-node-hanging-test-fix?activeTab=code So you can just add Otherwise, I'm not sure why is it happening. We would need some minimal repo to investigate it. |
Thank you for this amazing package
Describe the bug
When running when Node v14.17.5, I get the expected result.
But when using Node v16 or higher
When I run it with detectOpenHandles.
Am I missing something or should this just work?
Expected behavior
Same output for Node v16 and higher
Steps to Reproduce
Use Node v16 or higher
Screenshots
Versions
The text was updated successfully, but these errors were encountered: