9
9
'use strict' ;
10
10
11
11
const os = require ( 'os' ) ;
12
+ const path = require ( 'path' ) ;
12
13
const puppeteerBrowsers = require ( '@puppeteer/browsers' ) ;
13
14
14
15
async function download ( browser , version , cacheDir , platform ) {
@@ -24,7 +25,7 @@ async function download(browser, version, cacheDir, platform) {
24
25
}
25
26
26
27
module . exports = async ( config ) => {
27
- const cacheDir = process . cwd ( ) + '/ browsers';
28
+ const cacheDir = path . join ( process . cwd ( ) , ' browsers') ;
28
29
const platform = puppeteerBrowsers . detectBrowserPlatform ( ) ;
29
30
30
31
let browsers ;
@@ -58,13 +59,13 @@ module.exports = async(config) => {
58
59
'/Contents/MacOS/Safari Technology Preview' ;
59
60
}
60
61
61
- if ( browsers . includes ( 'firefox' ) && ! process . env . FIREFOX_BIN ) {
62
+ if ( browsers . includes ( 'firefox' ) ) {
62
63
const buildId = await download ( 'firefox' , process . env . BVER || 'stable' ,
63
64
cacheDir , platform ) ;
64
65
process . env . FIREFOX_BIN = puppeteerBrowsers
65
66
. computeExecutablePath ( { browser : 'firefox' , buildId, cacheDir, platform} ) ;
66
67
}
67
- if ( browsers . includes ( 'chrome' ) && ! process . env . CHROME_BIN ) {
68
+ if ( browsers . includes ( 'chrome' ) ) {
68
69
const buildId = await download ( 'chrome' , process . env . BVER || 'stable' ,
69
70
cacheDir , platform ) ;
70
71
process . env . CHROME_BIN = puppeteerBrowsers
0 commit comments