Use react@17 for useSyncExternalStore shim tests (#28055)

The tests for the shim need to test with ReactDOM.render in React 17.
This commit is contained in:
Ricky
2024-01-24 11:27:30 -05:00
committed by GitHub
parent 3d9b201327
commit ee1eb4826f
4 changed files with 59 additions and 16 deletions
+7 -2
View File
@@ -170,9 +170,14 @@ if (process.env.REACT_CLASS_EQUIVALENCE_TEST) {
return message;
}
const re = /react.dev\/errors\/(\d+)?\??([^\s]*)/;
const matches = message.match(re);
let matches = message.match(re);
if (!matches || matches.length !== 3) {
return message;
// Some tests use React 17, when the URL was different.
const re17 = /error-decoder.html\?invariant=(\d+)([^\s]*)/;
matches = message.match(re17);
if (!matches || matches.length !== 3) {
return message;
}
}
const code = parseInt(matches[1], 10);
const args = matches[2]