Skip to content

Commit

Permalink
print always list of browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya committed Jun 4, 2024
1 parent a06f43f commit ac716cc
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions test/browser/browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ 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';

Expand All @@ -13,25 +12,23 @@ describe('Test browser Parser in the node env', function() {

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'
try {
const browsers = child_process
.execSync('ls ~/.cache/puppeteer')
.toString()
.replace('\n', '');
if (!browsers) {
throw new Error(
'error listing browsers!'
);
throw error;
}
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');
Expand Down

0 comments on commit ac716cc

Please sign in to comment.