Skip to content
Permalink
Browse files
[DevTools] Remove string.replaceAll Call in @reactVersion Pragma Func…
…tions (#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.
  • Loading branch information
lunaruan committed May 19, 2022
1 parent d89657b commit 6e2f38f3a4d58f11bbe86ca6f938c27767366967
Showing 1 changed file with 2 additions and 4 deletions.
@@ -29,9 +29,8 @@ global.process.env.LIGHT_MODE_DIMMED_ERROR_COLOR = LIGHT_MODE_DIMMED_ERROR_COLOR
global.process.env.LIGHT_MODE_DIMMED_LOG_COLOR = LIGHT_MODE_DIMMED_LOG_COLOR;

global._test_react_version = (range, testName, callback) => {
const trimmedRange = range.replaceAll(' ', '');
const reactVersion = process.env.REACT_VERSION || ReactVersion.default;
const shouldPass = semver.satisfies(reactVersion, trimmedRange);
const shouldPass = semver.satisfies(reactVersion, range);

if (shouldPass) {
test(testName, callback);
@@ -41,9 +40,8 @@ global._test_react_version = (range, testName, callback) => {
};

global._test_react_version_focus = (range, testName, callback) => {
const trimmedRange = range.replaceAll(' ', '');
const reactVersion = process.env.REACT_VERSION || ReactVersion.default;
const shouldPass = semver.satisfies(reactVersion, trimmedRange);
const shouldPass = semver.satisfies(reactVersion, range);

if (shouldPass) {
// eslint-disable-next-line jest/no-focused-tests

0 comments on commit 6e2f38f

Please sign in to comment.