Skip to content

Commit

Permalink
test: use path.join to join path to browser
Browse files Browse the repository at this point in the history
  • Loading branch information
fippo committed Apr 20, 2024
1 parent 1ee2f65 commit 5bc6a87
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'use strict';

const os = require('os');
const path = require('path');
const puppeteerBrowsers = require('@puppeteer/browsers');

async function download(browser, version, cacheDir, platform) {
Expand All @@ -20,11 +21,12 @@ async function download(browser, version, cacheDir, platform) {
cacheDir,
platform
});
console.error(browser, version, platform, buildId);
return buildId;
}

module.exports = async(config) => {
const cacheDir = process.cwd() + '/browsers';
const cacheDir = path.join(process.cwd(), 'browsers');
const platform = puppeteerBrowsers.detectBrowserPlatform();

let browsers;
Expand All @@ -43,6 +45,8 @@ module.exports = async(config) => {
} else {
browsers = ['chrome', 'firefox'];
}
console.error('BROWSERS', browsers);
console.error('HRM1', browsers.includes('chrome'), process.env.CHROME_BIN);

let reporters = ['mocha'];
if (process.env.CI) {
Expand All @@ -64,11 +68,14 @@ module.exports = async(config) => {
process.env.FIREFOX_BIN = puppeteerBrowsers
.computeExecutablePath({browser: 'firefox', buildId, cacheDir, platform});
}
console.error('HRM', browsers.includes('chrome'), process.env.CHROME_BIN);
if (browsers.includes('chrome') && !process.env.CHROME_BIN) {
console.log('starting chrome download');
const buildId = await download('chrome', process.env.BVER || 'stable',
cacheDir, platform);
process.env.CHROME_BIN = puppeteerBrowsers
.computeExecutablePath({browser: 'chrome', buildId, cacheDir, platform});
console.log('done with chrome download', process.env.CHROME_BIN);
}

let chromeFlags = [
Expand Down

0 comments on commit 5bc6a87

Please sign in to comment.