diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 66ea65528..cefaea145 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -57,6 +57,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: "${{ steps.lockversion.outputs.version }}" + architecture: "${{ matrix.arch }}" - if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest' #npm cli 10 is buggy because of some cache issue name: Install npm cli 8 diff --git a/test/browser/browser.spec.ts b/test/browser/browser.spec.ts index 091641e33..7fc9a0ff2 100644 --- a/test/browser/browser.spec.ts +++ b/test/browser/browser.spec.ts @@ -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() { @@ -10,6 +12,28 @@ 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') { + // 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'); @@ -58,4 +82,4 @@ describe('Test browser Parser in the node env', function() { const diagnostics = await page.evaluate(element => element && element.textContent, diagnosticsDiv); expect(Number(diagnostics)).toBeGreaterThanOrEqual(0); }, 5000); -}); \ No newline at end of file +});