react
react copied to clipboard
Several tests fail on main with Node v16
There was a previous issue opened for this, which had a solution implemented by @bvaughn to resolve, but there still seem to be some edgecases remaining:
- https://github.com/facebook/react/issues/22441
- https://github.com/facebook/react/pull/22477
It looks like there are a number of variations of ways that are currently being used to test that aren't captured by the changes made in https://github.com/facebook/react/pull/22477
I'll just include one example for each pattern variation I saw in my failed test runs:
packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js expect(received).toEqual(expected) // deep equality Expected: "Cannot read property 'toUpperCase' of undefined" Received: "Cannot read properties of undefined (reading 'toUpperCase')"packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js expect(received).toBe(expected) // Object.is equality Expected: "Cannot read property 'useState' of null" Received: "Cannot read properties of null (reading 'useState')"So it looks like the other methods being used to test for this are
.toEqualand.toBeOriginally posted by @0xdevalias in https://github.com/facebook/react/issues/22441#issuecomment-1182863793
Currently the CircleCI seems to only run tests on one node version (as I discovered while looking into https://github.com/facebook/react/issues/24891). I wonder if it would make sense to run them in the CI for all node versions include in the package.json devEngines.node; to proactively catch edgecases like this.
Which specific node version is causing issues?
From the previous issue I linked:
I was on the latest NodeJS version (16.10.0). Note that tests pass for me when switching to the 14.x LTS release of Node.
16.10 was released september 2021. Does the issue persist if you switch to the latest 16.x minor i.e. 16.16?
This is an issue with all 16.x and higher due to a change in the underlying error messages from node; as the previously linked issue describes in more detail, which is why I linked it for context on the issue..