@@ -31,9 +31,10 @@ global.process.env.LIGHT_MODE_DIMMED_ERROR_COLOR =
3131 LIGHT_MODE_DIMMED_ERROR_COLOR ;
3232global . process . env . LIGHT_MODE_DIMMED_LOG_COLOR = LIGHT_MODE_DIMMED_LOG_COLOR ;
3333
34+ const ReactVersionTestingAgainst = process . env . REACT_VERSION || ReactVersion ;
35+
3436global . _test_react_version = ( range , testName , callback ) => {
35- const reactVersion = process . env . REACT_VERSION || ReactVersion ;
36- const shouldPass = semver . satisfies ( reactVersion , range ) ;
37+ const shouldPass = semver . satisfies ( ReactVersionTestingAgainst , range ) ;
3738
3839 if ( shouldPass ) {
3940 test ( testName , callback ) ;
@@ -43,8 +44,7 @@ global._test_react_version = (range, testName, callback) => {
4344} ;
4445
4546global . _test_react_version_focus = ( range , testName , callback ) => {
46- const reactVersion = process . env . REACT_VERSION || ReactVersion ;
47- const shouldPass = semver . satisfies ( reactVersion , range ) ;
47+ const shouldPass = semver . satisfies ( ReactVersionTestingAgainst , range ) ;
4848
4949 if ( shouldPass ) {
5050 // eslint-disable-next-line jest/no-focused-tests
@@ -71,12 +71,14 @@ global._test_ignore_for_react_version = (testName, callback) => {
7171// Longer term we should migrate all our tests away from using require() and
7272// resetModules, and use import syntax instead so this kind of thing doesn't
7373// happen.
74- lazyRequireFunctionExports ( 'react/jsx-dev-runtime' ) ;
74+ if ( semver . gte ( ReactVersionTestingAgainst , '17.0.0' ) ) {
75+ lazyRequireFunctionExports ( 'react/jsx-dev-runtime' ) ;
7576
76- // TODO: We shouldn't need to do this in the production runtime, but until
77- // we remove string refs they also depend on the shared state object. Remove
78- // once we remove string refs.
79- lazyRequireFunctionExports ( 'react/jsx-runtime' ) ;
77+ // TODO: We shouldn't need to do this in the production runtime, but until
78+ // we remove string refs they also depend on the shared state object. Remove
79+ // once we remove string refs.
80+ lazyRequireFunctionExports ( 'react/jsx-runtime' ) ;
81+ }
8082
8183function lazyRequireFunctionExports ( moduleName ) {
8284 jest . mock ( moduleName , ( ) => {
0 commit comments