diff --git a/package.json b/package.json index f00ff654..72b5d60c 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "merge-options": "^3.0.4", "ora": "^5.3.0", "path-browserify": "^1.0.1", - "playwright-core": "1.8.1", + "playwright-core": "1.9.1", "polka": "^0.5.2", "premove": "^3.0.1", "process": "^0.11.10", diff --git a/src/utils.js b/src/utils.js index a211817f..92e54d47 100644 --- a/src/utils.js +++ b/src/utils.js @@ -189,21 +189,20 @@ const redirectConsole = async (msg) => { }; const getPw = async (browserName) => { - const cachePath = path.join(process.cwd(), 'node_modules', '.cache'); - const { installBrowsersWithProgressBar } = require('playwright-core/lib/install/installer'); const setupInProcess = require('playwright-core/lib/inprocess'); const browsers = require('playwright-core/browsers.json'); + const browsersPath = require.resolve('playwright-core/browsers.json'); browsers.browsers[0].download = true; // chromium browsers.browsers[1].download = true; // firefox browsers.browsers[2].download = true; // webkit - fs.mkdirSync(cachePath, { recursive: true }); + fs.writeFileSync( - path.join(cachePath, 'browsers.json'), + browsersPath, JSON.stringify(browsers, null, 2) ); - await installBrowsersWithProgressBar(cachePath, [browserName]); + await installBrowsersWithProgressBar([browserName]); const api = setupInProcess; return api[browserName];