Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Karma and Firefox with WSL

I would like to run karma tests using Firefox under WSL. I have firefox installed via apt and it is working using VcXsrv in Windows. When I use karma-firefox-launcher, however, I get a "Cannot start Firefox" error. Has anybody successfully gotten this to work? If so, how?

like image 927
muaddoob Avatar asked Dec 01 '22 12:12

muaddoob


1 Answers

Hello I've faced with this problem, but instead of FF it was the Google chrome, and it took awhile to figure it out. So I'll publish my solution here, maybe it can help someone.

If you are windows user on WSL and you are trying to run ng test you will get an error which says

No binary for Chrome browser on your platform. Please, set "CHROME_BIN" env variable.

Reason is that actually you don't have chrome on you linux machine and you are trying to run your tests in it.

My solution is to create an alias from linux to windws's chrome

alias launchchrome="\"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe\""

and after that export it as a linux env variable

export CHROME_BIN=launchchrome

That's it, now if you run ng test your standard chrome will be used!

like image 172
Gh111 Avatar answered Dec 28 '22 06:12

Gh111