karma-runner / karma-chrome-launcher

A Karma plugin. Launcher for Chrome and Chrome Canary.
MIT License
469 stars 119 forks source link

Chrome headless lost WebGL support on MacOS #263

Open elalish opened 1 year ago

elalish commented 1 year ago

Starting with Chrome 109, WebGL contexts can no longer be created in my Karma tests, meaning I can no longer run my tests locally. It appears to be because Chrome no longer supports software rendering on Arm-based macbooks, so the work-around is to enable the GPU instead: https://bugs.chromium.org/p/chromium/issues/detail?id=1407025#c9

I tried adding the indicated flags, but it's still not working because the launcher is also adding --disable-gpu: https://github.com/karma-runner/karma-chrome-launcher/blob/5f70a76de87ecbb57f3f3cb556aa6a2a1a4f643f/index.js#L172

Is there a reason the GPU should be disabled in headless mode? Is there a workaround for this, or can we remove this flag?

dollysingh3192 commented 1 year ago

Getting Same Error. Can we expect the fix asap?

HarelM commented 1 year ago

Do you guys have a workaround? maybe patch-package? How did you solve this, I ran into this problem just now...

elalish commented 1 year ago

Karma got deprecated since I opened this, so I ended up switching to the modern web test runner instead. It's working great! My PR looks huge, but that was mostly other cleanup; you can see the new config here.

HarelM commented 1 year ago

So you switched from karma to playwright? Can you link to the karma deprecation article? Or are you saying that only this plugin got deprecated?

elalish commented 1 year ago

https://github.com/karma-runner/karma#karma-is-deprecated-and-is-not-accepting-new-features-or-general-bug-fixes

HarelM commented 1 year ago

THANKS!!

PabloAlexis611 commented 6 months ago

If you don't have a hard requirement for Chrome Headless, using regular Chrome will not have the WebGL issue.

I just did that (granted it uses more memory, but at least I can run my unit tests without switching unit test frameworks or manually patching a file inside node_modules/)