Description
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:
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 #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 #22441 (comment)
Currently the CircleCI seems to only run tests on one node version (as I discovered while looking into #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.