Skip to content

Conversation

@HM-23-HM
Copy link

Summary

Annotations like // @reactVersion >= 16.9 were not being handled properly by the jest preprocessor on a Windows computer. This resulted in tests running that should have been skipped.

The root cause was that the relevant regular expressions in preprocessor.js were not matching the backslashes in Windows paths, so I updated them.

How did you test this change?

I isolated some of the test cases that were running (and failing), but should have been skipped. One example is the "should handle stress test with reordering" test in the following file:
react\packages\react-devtools-shared\src\__tests__\storeStressSync-test.js which has the following annotations:

  // @reactVersion >= 16.9
  // @reactVersion <= 18.2

Here's the command I used to evaluate the fix:
yarn test-build-devtools --testNamePattern="should handle stress test with reordering"

Output (Before):

 FAIL  packages/react-devtools-shared/src/__tests__/storeStressSync-test.js (19.716 s)
  ● StoreStress (Legacy Mode) › should handle stress test with reordering (Legacy Mode)

    TypeError: ReactDOM.render is not a function

      154 |       ['ReactDOM.render has not been supported since React 18'],
      155 |       () => {
    > 156 |         ReactDOM.render(elements, container);
          |                  ^
      157 |       },
      158 |     );
      159 |

      at packages/react-devtools-shared/src/__tests__/utils.js:156:18
      at withErrorsOrWarningsIgnored (packages/react-devtools-shared/src/__tests__/utils.js:459:25)
      at render (packages/react-devtools-shared/src/__tests__/utils.js:153:5)
      at packages/react-devtools-shared/src/__tests__/storeStressSync-test.js:358:31
      at packages/react-devtools-shared/src/__tests__/utils.js:78:7
      at Object.<anonymous>.process.env.NODE_ENV.exports.act (build/oss-experimental/react/cjs/react.development.js:907:22)
      at packages/react-devtools-shared/src/__tests__/utils.js:77:5
      at Object.<anonymous>.process.env.NODE_ENV.exports.act (build/oss-experimental/react/cjs/react.development.js:907:22)
      at act (packages/react-devtools-shared/src/__tests__/utils.js:76:3)
      at _loop3 (packages/react-devtools-shared/src/__tests__/storeStressSync-test.js:358:7)    
      at Object.<anonymous> (packages/react-devtools-shared/src/__tests__/storeStressSync-test.js:363:301)

 PASS  packages/react-devtools-shared/src/__tests__/storeStressTestConcurrent-test.js (16.505 s)

Summary of all failing tests
 FAIL  packages/react-devtools-shared/src/__tests__/storeStressSync-test.js (19.716 s)
  ● StoreStress (Legacy Mode) › should handle stress test with reordering (Legacy Mode)

    TypeError: ReactDOM.render is not a function

      154 |       ['ReactDOM.render has not been supported since React 18'],
      155 |       () => {
    > 156 |         ReactDOM.render(elements, container);
          |                  ^
      157 |       },
      158 |     );
      159 |

      at packages/react-devtools-shared/src/__tests__/utils.js:156:18
      at withErrorsOrWarningsIgnored (packages/react-devtools-shared/src/__tests__/utils.js:459:25)
      at render (packages/react-devtools-shared/src/__tests__/utils.js:153:5)
      at packages/react-devtools-shared/src/__tests__/storeStressSync-test.js:358:31
      at packages/react-devtools-shared/src/__tests__/utils.js:78:7
      at Object.<anonymous>.process.env.NODE_ENV.exports.act (build/oss-experimental/react/cjs/react.development.js:907:22)
      at packages/react-devtools-shared/src/__tests__/utils.js:77:5
      at Object.<anonymous>.process.env.NODE_ENV.exports.act (build/oss-experimental/react/cjs/react.development.js:907:22)
      at act (packages/react-devtools-shared/src/__tests__/utils.js:76:3)
      at _loop3 (packages/react-devtools-shared/src/__tests__/storeStressSync-test.js:358:7)    
      at Object.<anonymous> (packages/react-devtools-shared/src/__tests__/storeStressSync-test.js:363:301)


Test Suites: 1 failed, 41 skipped, 1 passed, 2 of 43 total
Tests:       1 failed, 517 skipped, 1 passed, 519 total
Snapshots:   1 passed, 1 total
Time:        30.984 s, estimated 123 s
Ran all test suites with tests matching "should handle stress test with reordering".
error Command failed with exit code 1.

Output (After):

 PASS  packages/react-devtools-shared/src/__tests__/storeStressTestConcurrent-test.js (16.079 s)

Test Suites: 42 skipped, 1 passed, 1 of 43 total
Tests:       518 skipped, 1 passed, 519 total
Snapshots:   1 passed, 1 total
Time:        30.221 s, estimated 123 s
Ran all test suites with tests matching "should handle stress test with reordering".
Done in 33.55s.

@meta-cla
Copy link

meta-cla bot commented Dec 14, 2025

Hi @HM-23-HM!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@HM-23-HM HM-23-HM marked this pull request as ready for review December 14, 2025 19:06
@meta-cla
Copy link

meta-cla bot commented Dec 14, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant