Skip to content

Commit

Permalink
chore: fix failing windows test (#10829)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Nov 15, 2020
1 parent ed90920 commit 45c0b2a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion e2e/__tests__/jestChangedFiles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ const gitVersionSupportsInitialBranch = (() => {
const {stdout} = run(`${GIT} --version`);
const gitVersion = stdout.split(' ').slice(-1)[0];

return semver.gte(gitVersion, '2.28.0');
const match = gitVersion.match(/(?<version>\d+\.\d+\.\d+)/);

if (match?.groups?.version == null) {
throw new Error(`Unable to parse git version from string "${gitVersion}"`);
}

const {version} = match.groups;

return semver.gte(version, '2.28.0');
})();

const mainBranchName = gitVersionSupportsInitialBranch ? 'main' : 'master';
Expand Down
10 changes: 9 additions & 1 deletion e2e/__tests__/onlyChanged.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ const gitVersionSupportsInitialBranch = (() => {
const {stdout} = run(`${GIT} --version`);
const gitVersion = stdout.split(' ').slice(-1)[0];

return semver.gte(gitVersion, '2.28.0');
const match = gitVersion.match(/(?<version>\d+\.\d+\.\d+)/);

if (match?.groups?.version == null) {
throw new Error(`Unable to parse git version from string "${gitVersion}"`);
}

const {version} = match.groups;

return semver.gte(version, '2.28.0');
})();

const mainBranchName = gitVersionSupportsInitialBranch ? 'main' : 'master';
Expand Down

0 comments on commit 45c0b2a

Please sign in to comment.