Closed mgol closed 9 months ago
I can reproduce this after upgrading to the latest Firefox, Firefox 121.0.1 (64-bit), with macOS 13, and an Apple M1 processor.
If you enable logLevel: 'DEBUG'
in karma.conf.js, there is a bit more detail:
10 01 2024 15:30:03.664:DEBUG [plugin]: Loading karma-* from /Users/krinkle/Temp/karma-test/node_modules
10 01 2024 15:30:03.666:DEBUG [plugin]: Loading plugin /Users/krinkle/Temp/karma-test/node_modules/karma-chrome-launcher.
10 01 2024 15:30:03.668:DEBUG [plugin]: Loading plugin /Users/krinkle/Temp/karma-test/node_modules/karma-firefox-launcher.
10 01 2024 15:30:03.670:DEBUG [plugin]: Loading plugin /Users/krinkle/Temp/karma-test/node_modules/karma-qunit.
10 01 2024 15:30:03.672:DEBUG [web-server]: Instantiating middleware
10 01 2024 15:30:03.682:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9876/
10 01 2024 15:30:03.682:INFO [launcher]: Launching browsers FirefoxHeadless with concurrency unlimited
10 01 2024 15:30:03.684:INFO [launcher]: Starting browser FirefoxHeadless
10 01 2024 15:30:03.684:DEBUG [launcher]: null -> BEING_CAPTURED
10 01 2024 15:30:03.684:DEBUG [temp-dir]: Creating temp dir at /var/folders/_5/khc4z6kx4nbg4mn5wxyzbsn40000gn/T/karma-8869174
10 01 2024 15:30:03.685:DEBUG [launcher]: /Applications/Firefox.app/Contents/MacOS/firefox-bin http://localhost:9876/?id=8869174 -profile /var/folders/_5/khc4z6kx4nbg4mn5wxyzbsn40000gn/T/karma-8869174 -no-remote -wait-for-browser -headless --start-debugger-server 6000
10 01 2024 15:30:03.721:DEBUG [launcher]: Process FirefoxHeadless exited with code null and signal SIGKILL
10 01 2024 15:30:03.721:ERROR [launcher]: Cannot start FirefoxHeadless
10 01 2024 15:30:03.721:ERROR [launcher]: FirefoxHeadless stdout:
10 01 2024 15:30:03.721:ERROR [launcher]: FirefoxHeadless stderr:
10 01 2024 15:30:03.721:DEBUG [temp-dir]: Cleaning temp dir /var/folders/_5/khc4z6kx4nbg4mn5wxyzbsn40000gn/T/karma-8869174
10 01 2024 15:30:03.723:INFO [launcher]: Trying to start FirefoxHeadless again (1/2).
[…]
This is reproducible even without Karma:
$ /Applications/Firefox.app/Contents/MacOS/firefox-bin
Killed: 9
Hence this is more about Firefox generally no longer working from the command-line, and not something Karma can do anything about. I suspect it has something to do with the security mechanisms in macOS disallowing the process to run from the Terminal application. Perhaps Mozilla changed the way it signs the Firefox binary? Or perhaps Firefox changed the way it replaces the binary during an upgrade that makes macOS treat it as suspicious.
Possibly related:
Resolution:
Selenium has the same issue:
This issue will affect everyone on recent macOS running Firefox 121 or newer.
I've been able to patch a workaround by replacing the firefox-bin executable with a symlink that pointed to the firefox executable;
sudo mv /Applications/Firefox.app/Contents/MacOS/firefox-bin /Applications/Firefox.app/Contents/MacOS/firefox-bin.old
sudo ln -s /Applications/Firefox.app/Contents/MacOS/firefox /Applications/Firefox.app/Contents/MacOS/firefox-bin
So my guess would be that if in karma-firefox-launcher/index.js the line
const suffix = '.app/Contents/MacOS/firefox-bin'
were replaced with
const suffix = '.app/Contents/MacOS/firefox'
it may work.
This issue will affect everyone on recent macOS
It also happens on macOS 11.7.10 on an Intel processor
It also happens on macOS 11.7.10 on an Intel processor
Right; the issue is independent on the macOS version, it affects all Firefox versions from 121 on any macOS version. Basically, right now karma-firefox-launcher
is completely broken for all macOS users.
@birtles @ewinslow I know this is not a security fix but considering that without PR #330 this package is not working at all on macOS and that the fix is a one-liner, is there any chance of merging it & releasing a new version?
@pmvald Thanks for merging #330. Any chance for a new release now so that we can use this fix?
@XhmikosR @pmvald Would you be able to publish a release for the above? Alternatively, I'd be happy to help myself if you'd be comfortable with me having Git write and npm co-owner access for this package (ref https://github.com/karma-runner/karma-qunit/pull/185).
@Krinkle I don't even have rights myself 😛
IIRC I only had rights in karma-qunit.
I cannot start Firefox (or FirefoxHeadless) 121 on macOS Sonoma
14.2.1 (23C71)
. It used to work on that very OS a few weeks ago, possibly with Firefox 120. EDIT: confirmed - this issue will affect everyone on recent macOS running Firefox 121 or newer.A very simple test case doesn't work, just follow instructions from https://github.com/mgol/karma-test. When doing so, I am getting:
The error message is the same as in #93. However, I am running it directly on a normal OS, not behind Docker.