[DevTools] Remove string.replaceAll Call in @reactVersion Pragma Functions (#24584)
`string.replaceAll` doesn't exist in our CircleCI Docker environment. We also don't need it in this case because `semver.satisfies` allows for whitespace when specifying a range. This PR removes the unnecessary call.
Luna Ruan committed
May 19, 2022 at 09:59 UTC
6e2f38f3a4d58f11bbe86ca6f938c27767366967
1 file changed
+2
-4
scripts/jest/devtools/setupEnv.js
+2
-4
@@ -29,9 +29,8 @@ global.process.env.LIGHT_MODE_DIMMED_ERROR_COLOR = LIGHT_MODE_DIMMED_ERROR_COLOR
29
global.process.env.LIGHT_MODE_DIMMED_LOG_COLOR = LIGHT_MODE_DIMMED_LOG_COLOR;
30
31
global._test_react_version = (range, testName, callback) => {
32
- const trimmedRange = range.replaceAll(' ', '');
32
const reactVersion = process.env.REACT_VERSION || ReactVersion.default;
34
- const shouldPass = semver.satisfies(reactVersion, trimmedRange);
33
+ const shouldPass = semver.satisfies(reactVersion, range);
34
35
if (shouldPass) {
36
test(testName, callback);
@@ -41,9 +40,8 @@ global._test_react_version = (range, testName, callback) => {
40
};
41
42
global._test_react_version_focus = (range, testName, callback) => {
44
- const trimmedRange = range.replaceAll(' ', '');
43
const reactVersion = process.env.REACT_VERSION || ReactVersion.default;
46
- const shouldPass = semver.satisfies(reactVersion, trimmedRange);
44
+ const shouldPass = semver.satisfies(reactVersion, range);
45
46
if (shouldPass) {
47
// eslint-disable-next-line jest/no-focused-tests