Skip to content

Commit 17db8a2

Browse files
authored
fix(binaries): filter m1 mac chromedriver versions (#478)
Fixes #476
1 parent 4e2c8a7 commit 17db8a2

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

lib/binaries/chrome_xml.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ export class ChromeXml extends XmlConfigSource {
3232
for (let content of xml.ListBucketResult.Contents) {
3333
let contentKey: string = content.Key[0];
3434

35-
36-
// Filter for 32-bit devices, make sure x64 is not an option
37-
if (this.osarch === 'x64' || !contentKey.includes('64')) {
35+
if (
36+
// Filter for 32-bit devices, make sure x64 is not an option
37+
(this.osarch.includes('64') || !contentKey.includes('64')) &&
38+
// Filter for x86 macs, make sure m1 is not an option
39+
((this.ostype === 'Darwin' && this.osarch === 'arm64') || !contentKey.includes('m1'))) {
3840
// Filter for only the osType
3941
if (contentKey.includes(osType)) {
4042
versionPaths.push(contentKey);
@@ -95,7 +97,9 @@ export class ChromeXml extends XmlConfigSource {
9597
(this.osarch !== 'x64' && !item.includes(this.getOsTypeName() + '64'))) {
9698
itemFound = item;
9799
}
98-
100+
if (this.osarch === 'arm64' && this.ostype === 'Darwin' && item.includes('m1')) {
101+
itemFound = item;
102+
}
99103
}
100104
// If the semantic version is the same, check os arch.
101105
// For 64-bit systems, prefer the 64-bit version.

spec/binaries/chrome_xml_spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe('chrome xml reader', () => {
1717
chromeXml.getVersionList().then(list => {
1818
for (let item of list) {
1919
expect(item).toContain('/chromedriver_mac');
20+
expect(item).not.toContain('m1');
2021
}
2122
done();
2223
});
@@ -65,4 +66,15 @@ describe('chrome xml reader', () => {
6566
done();
6667
});
6768
});
69+
70+
it('should get the 87.0.4280.88, 64-bit, m1 version (arch = arm64)', (done) => {
71+
let chromeXml = new ChromeXml();
72+
chromeXml.out_dir = out_dir;
73+
chromeXml.ostype = 'Darwin';
74+
chromeXml.osarch = 'arm64';
75+
chromeXml.getUrl('87.0.4280.88').then((binaryUrl) => {
76+
expect(binaryUrl.url).toContain('87.0.4280.88/chromedriver_mac64_m1.zip');
77+
done();
78+
});
79+
});
6880
});

0 commit comments

Comments
 (0)