react icon indicating copy to clipboard operation
react copied to clipboard

Several tests fail on main with Node v16

Open 0xdevalias opened this issue 3 years ago • 4 comments
trafficstars

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 .toEqual and .toBe

Originally 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.

0xdevalias avatar Jul 13 '22 07:07 0xdevalias

Which specific node version is causing issues?

eps1lon avatar Jul 14 '22 16:07 eps1lon

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.

0xdevalias avatar Jul 15 '22 11:07 0xdevalias

16.10 was released september 2021. Does the issue persist if you switch to the latest 16.x minor i.e. 16.16?

eps1lon avatar Jul 15 '22 18:07 eps1lon

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..

0xdevalias avatar Jul 16 '22 09:07 0xdevalias