diff --git a/lib/binaries/chrome_xml.ts b/lib/binaries/chrome_xml.ts index 606425ce..5d22b52b 100644 --- a/lib/binaries/chrome_xml.ts +++ b/lib/binaries/chrome_xml.ts @@ -129,11 +129,12 @@ export class ChromeXml extends XmlConfigSource { * Chromedriver is the only binary that does not conform to semantic versioning * and either has too little number of digits or too many. To get this to be in * semver, we will either add a '.0' at the end or chop off the last set of - * digits. This is so we can compare to find the latest and greatest. + * digits (the patch number) and use it as a pre-release version. This is so we + * can compare to find the latest and greatest. * * Example: * 2.46 -> 2.46.0 - * 75.0.3770.8 -> 75.0.3770 + * 75.0.3770.8 -> 75.0.3770-patch.8 * * @param version */ @@ -151,10 +152,10 @@ export function getValidSemver(version: string): string { } // This supports downloading 74.0.3729.6 try { - const newRegex = /(\d+.\d+.\d+).\d+/g; + const newRegex = /(\d+.\d+.\d+).(\d+)/g; const exec = newRegex.exec(version); if (exec) { - lookUpVersion = exec[1]; + lookUpVersion = `${exec[1]}-patch.${exec[2]}`; } } catch (_) { // no-op: if this does not work, use the other regex pattern. diff --git a/lib/cmds/status.ts b/lib/cmds/status.ts index 2def1963..0d531dd8 100644 --- a/lib/cmds/status.ts +++ b/lib/cmds/status.ts @@ -95,7 +95,7 @@ function status(options: Options) { if (semver.gt(a, b)) { return 1; } else { - return 0; + return -1; } }); for (let ver in downloaded.versions) { diff --git a/spec/binaries/chrome_xml_spec.ts b/spec/binaries/chrome_xml_spec.ts index ebaa2855..b33b6fe6 100644 --- a/spec/binaries/chrome_xml_spec.ts +++ b/spec/binaries/chrome_xml_spec.ts @@ -90,4 +90,15 @@ describe('chrome xml reader', () => { done(); }); }); + + it('should get the 91.0.4472.101, 64-bit, m1 version (arch = arm64)', (done) => { + let chromeXml = new ChromeXml(); + chromeXml.out_dir = out_dir; + chromeXml.ostype = 'Darwin'; + chromeXml.osarch = 'arm64'; + chromeXml.getUrl('91.0.4472.101').then((binaryUrl) => { + expect(binaryUrl.url).toContain('91.0.4472.101/chromedriver_mac64_m1.zip'); + done(); + }); + }); }); diff --git a/spec/cmds/status_spec.ts b/spec/cmds/status_spec.ts index ffd28b3a..a8996a61 100644 --- a/spec/cmds/status_spec.ts +++ b/spec/cmds/status_spec.ts @@ -33,7 +33,7 @@ describe('status', () => { .catch(err => { done.fail(); }); - }); + }, 30000); it('should show the version number of the default and latest versions', () => { let lines =