diff --git a/test/browser/browser.spec.ts b/test/browser/browser.spec.ts index 2b25c5c36..7fc9a0ff2 100644 --- a/test/browser/browser.spec.ts +++ b/test/browser/browser.spec.ts @@ -2,6 +2,7 @@ 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'; @@ -12,23 +13,26 @@ describe('Test browser Parser in the node env', function() { beforeAll(async function() { // if MacOS M1/M2, provide your own path to chromium - try { - const browsers = child_process - .execSync('ls ~/.cache/puppeteer') - .toString() - .replace('\n', ''); - if (!browsers) { - throw new Error( - 'error listing browsers!' + if (os.platform() === 'darwin') { + // 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; } - 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');