Skip to content

Commit

Permalink
Fix version number parsing in cannotReadPropertyOfUndefined__DEPRECAT…
Browse files Browse the repository at this point in the history
…ED (#4314)

Summary:
`.match` is a super confusing API. The first value is the full match. To get the parenthesized full match, you need to look at the second value.

Originally added here: f5c48cd (D45432790)

Pull Request resolved: #4314

Test Plan:
Look at test run in Node version 14 GitHub CI and see that there are nolonger any instance of errors that look like this:

![Screenshot 2023-05-11 at 12 44 11 PM](https://github.com/facebook/relay/assets/162735/fb35dd55-4922-404d-a0b0-d08b78800618)

(Note that there are other errors in GitHub CI right now)

Reviewed By: yungsters

Differential Revision: D45789179

Pulled By: captbaritone

fbshipit-source-id: 9ffc02b1ea22381717beedd9762714fc4eb35b1c
  • Loading branch information
captbaritone authored and facebook-github-bot committed May 11, 2023
1 parent 7094921 commit e784ee4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/relay-test-utils-internal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function cannotReadPropertyOfUndefined__DEPRECATED(
propertyName: string,
): string {
const matches = process.version.match(/^v(\d+)\./);
const majorVersion = matches == null ? null : parseInt(matches[0], 10);
const majorVersion = matches == null ? null : parseInt(matches[1], 10);
if (majorVersion == null || majorVersion < 16) {
return `Cannot read property '${propertyName}' of undefined`;
}
Expand Down

0 comments on commit e784ee4

Please sign in to comment.