Skip to content

Commit

Permalink
list browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya committed Jun 4, 2024
1 parent 7c9f5f4 commit 40e4244
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/browser/browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import fs from 'fs';
import http from 'http';
import path from 'path';
import url from 'url';
import os from 'os';
import * as child_process from 'child_process';
import puppeteer from 'puppeteer';

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

beforeAll(async function() {
// if MacOS M1/M2, provide your own path to chromium
if (os.platform() === 'darwin' && os.arch() === 'arm64') {
try {
const browsers = child_process
.execSync('ls ~/.cache/puppeteer')
.toString()
.replace('\n', '');
if (!browsers) {
throw new Error(
'error listing browsers!'
);
}
console.log('BROWSERS:', browsers);
} catch (error) {
console.error(error);
console.log(
'\n\nUnable to find browsers\n\n'
);
throw error;
}
}
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const htmlPath = path.resolve(__dirname, 'sample-page.html');
const parserScript = path.resolve(__dirname, '../../browser/index.js');
Expand Down

0 comments on commit 40e4244

Please sign in to comment.