From e46e205b4e305688550e934ad54129df9baa92a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Vechina?= Date: Tue, 15 Jun 2021 16:12:49 +0100 Subject: [PATCH 1/3] fix(chromedriver): use chromedriver patch version as semver pre-release version --- lib/binaries/chrome_xml.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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. From f2fc60e74b88c0696e6372421e661214f335a4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Vechina?= Date: Tue, 15 Jun 2021 18:04:48 +0100 Subject: [PATCH 2/3] fix(chromedriver): fix unstable unit tests on cli status command --- lib/cmds/status.ts | 2 +- spec/cmds/status_spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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 = From 04657bb22b8a3ebd7685192f92d6082f345eb85e Mon Sep 17 00:00:00 2001 From: Bruna Teixeira Date: Wed, 16 Jun 2021 10:15:18 +0100 Subject: [PATCH 3/3] fix(chromedriver): add unit test --- spec/binaries/chrome_xml_spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) 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(); + }); + }); });