Skip to content

Commit

Permalink
[DevTools] Remove string.replaceAll Call in @reactVersion Pragma Func…
Browse files Browse the repository at this point in the history
…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 6e2f38f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scripts/jest/devtools/setupEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 6e2f38f

Please sign in to comment.