diff --git a/src/utils/__tests__/version.test.ts b/src/utils/__tests__/version.test.ts index 76020deb..c3922d84 100644 --- a/src/utils/__tests__/version.test.ts +++ b/src/utils/__tests__/version.test.ts @@ -195,25 +195,6 @@ describe('versionGreaterOrEqualThan', () => { expect(() => versionGreaterOrEqualThan(v1, v2)).toThrowError(); expect(() => versionGreaterOrEqualThan(v2, v1)).toThrowError(); }); - - test('can compare pre parts that are the same', () => { - let v1 = parseVersion('1.2.3-dev.0')!; - let v2 = parseVersion('1.2.3-dev.0')!; - expect(versionGreaterOrEqualThan(v1, v2)).toBe(true); - expect(versionGreaterOrEqualThan(v2, v1)).toBe(true); - - v1 = parseVersion('1.2.3-dev.0+A')!; - v2 = parseVersion('1.2.3-dev.0+A')!; - expect(versionGreaterOrEqualThan(v1, v2)).toBe(true); - expect(versionGreaterOrEqualThan(v2, v1)).toBe(true); - }); - - test('can compare pre parts that are the same but have different builds', () => { - const v1 = parseVersion('1.2.3-dev.0+buildA')!; - const v2 = parseVersion('1.2.3-dev.0+buildB')!; - expect(versionGreaterOrEqualThan(v1, v2)).toBe(false); - expect(versionGreaterOrEqualThan(v2, v1)).toBe(false); - }); }); describe('getPackage', () => { diff --git a/src/utils/version.ts b/src/utils/version.ts index 853e5d8b..5ab3581a 100644 --- a/src/utils/version.ts +++ b/src/utils/version.ts @@ -89,8 +89,6 @@ export function versionGreaterOrEqualThan(v1: SemVer, v2: SemVer): boolean { return true; } else if (v1.pre && !v2.pre) { return false; - } else if (v1.pre && v2.pre && v1.pre === v2.pre) { - return v1.build === v2.build; } else if (v1.pre && v2.pre && v1.pre !== v2.pre && /^\d+$/.test(v1.pre) && /^\d+$/.test(v2.pre)) { return v1.pre > v2.pre; } else if (v1.build || v2.build || v1.pre || v2.pre) { @@ -159,6 +157,7 @@ export function getPackageVersion(): string { * Returns the stringified version of the passed SemVer object. */ export function semVerToString(s: SemVer) { - return `${s.major}.${s.minor}.${s.patch}${s.pre ? `-${s.pre}` : ''}${s.build ? `+${s.build}` : '' - }`; + return `${s.major}.${s.minor}.${s.patch}${s.pre ? `-${s.pre}` : ''}${ + s.build ? `+${s.build}` : '' + }`; }