Skip to content

Commit 8e80f8c

Browse files
committed
list browsers
1 parent 7c9f5f4 commit 8e80f8c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/browser/browser.spec.ts

+23
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import fs from 'fs';
22
import http from 'http';
33
import path from 'path';
44
import url from 'url';
5+
import os from 'os';
6+
import * as child_process from 'child_process';
57
import puppeteer from 'puppeteer';
68

79
describe('Test browser Parser in the node env', function() {
@@ -10,6 +12,27 @@ describe('Test browser Parser in the node env', function() {
1012
let page: puppeteer.Page;
1113

1214
beforeAll(async function() {
15+
// if MacOS M1/M2, provide your own path to chromium
16+
if (os.platform() === 'darwin' && os.arch() === 'arm64') {
17+
try {
18+
const browsers = child_process
19+
.execSync('ll ~/.cache/puppeteer')
20+
.toString()
21+
.replace('\n', '');
22+
if (!browsers) {
23+
throw new Error(
24+
'error listing browsers!'
25+
);
26+
}
27+
console.log('BROWSERS:', browsers);
28+
} catch (error) {
29+
console.error(error);
30+
console.log(
31+
'\n\nUnable to find browsers\n\n'
32+
);
33+
throw error;
34+
}
35+
}
1336
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
1437
const htmlPath = path.resolve(__dirname, 'sample-page.html');
1538
const parserScript = path.resolve(__dirname, '../../browser/index.js');

0 commit comments

Comments
 (0)