question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error running web-test-runner from WSL

See original GitHub issue

Hi,

I’m getting the following error when running web-test-runner src/**/*.spec.js in WSL

Error: Could not automatically find any installation of Chrome. If it is installed, use the “installationPath” option to set it manually. Use @web/test-runner-puppeteer or @web/test-runner-playwright for a bundled browser.

I have CHROME_PATH as follows:

CHROME_PATH=“/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe”

I’m able to run chrome from WSL command line with the variable above.

Any thoughts ?

Thanks,

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
geoffrichcommented, Mar 25, 2021

For future reference, I ran into a similar issue where chrome launcher was trying to use my Windows Chrome installation, not my WSL Chrome installation. This was throwing the below error.

Failed to launch local browser installed at /mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe. This could be because of a mismatch between the version of puppeteer and Chrome or Chromium. Try updating either of them, or adjust the executablePath option to point to another browser installation. Use the --puppeteer flag to run tests with bundled compatible version of Chromium.

test/component.test.js:

 ❌ connect ECONNREFUSED 127.0.0.1:49515 

Chrome: |██████████████████████████████| 1/1 test files | 0 passed, 0 failed

The solution was to set an environment variable that points to my WSL installation.

export CHROME_PATH=/usr/bin/google-chrome

This can also be set in the launch options.

import { chromeLauncher } from '@web/test-runner-chrome';

export default {
  browsers: [
    chromeLauncher({
      launchOptions: {
        executablePath: '/usr/bin/google-chrome'
      },
    }),
  ],
};
2reactions
LarsDenBakkercommented, Dec 29, 2020

@dmondev sorry this issue was sitting here for a while. We delegate the logic for finding the installation to chrome-launcher. It runs inside node, are you sure that environment variable is available inside the unix subsystem? I removed one extra layer of abstraction on our side in https://github.com/modernweb-dev/web/pull/1146, and improved the error message. Perhaps you could try again?

@tvvignesh looks like it’s complaining about the chrome version, do you have an older version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Windows Subsystem for Linux | Microsoft Learn
Provides detailed information about common errors and issues people run into while running Linux on the Windows Subsystem for Linux.
Read more >
Test Runner: CLI and Configuration - Modern Web
When running tests regularly, the tests from regular config and the groups will be run. You can run only the tests of a...
Read more >
Web Component Automated Testing - Auro Design System
Components created using the WC-Generator will be configured with testing tools based on open-wc recommendations and modern web test runner . The tests...
Read more >
Error when running airflow webserver on WSL Ubuntu
I fixed the issue by updating WSL from 1 to WSL 2, removing Ubuntu and installing it again from Windows App Store and...
Read more >
@web/test-runner - npm
Start using @web/test-runner in your project by running `npm i @web/test-runner`. There are 21 other projects in the npm registry using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found