diff --git a/src/browsers.js b/src/browsers.js index 0598e37..22334de 100644 --- a/src/browsers.js +++ b/src/browsers.js @@ -127,15 +127,19 @@ const LocalBrowser = { } }; +// - iterate from a Set to de-duplicate because `PROGRAMFILES`, and `ProgramW6432` are +// often "C:\Program Files" which, we'd otherwise check three times. +// - use filter() to remove empty entries. +// // https://github.com/karma-runner/karma-chrome-launcher/blob/v3.2.0/index.js // https://github.com/vweevers/win-detect-browsers/blob/v7.0.0/lib/browsers.js -const WINDOWS_DIRS = [ +const WINDOWS_DIRS = new Set([ process.env.LOCALAPPDATA, process.env.PROGRAMFILES, process.env['PROGRAMFILES(X86)'], process.env.ProgramW6432, 'C:\\Program Files' -].filter(Boolean); +].filter(Boolean)); function createFirefoxPrefsJs (prefs) { let js = ''; @@ -259,6 +263,9 @@ async function firefox (url, signal, logger) { } async function chromium (paths, url, signal, logger) { + if (process.platform === 'win32') { + logger.debug('whatsinthere', [...WINDOWS_DIRS]); + } const dataDir = LocalBrowser.makeTempDir(); // https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md const args = [