lucono/karma-test-explorer

Karma server will not start

JonatanE opened this issue · 2 comments

Describe the Bug

Karma Test Explorer won't start because of an error: Browser Failure - cannot start

Steps to Reproduce the Behavior

I open a workspace where I have an angular project in a sub-folder. Karma Test Explorer is configured to use that folder as the project folder. Everything works as expected when I run "ng test" in that folder

Describe the Expected Behavior

Karma should start and I should see the test in the Tests panel

Provide Debug Logs
[2022-01-12 09:41:55.302] [DEBUG] [TestLocator]: Refreshed 140 spec files from glob list in 1.74 secs: ["/*{.,-,_}{test,spec,unit}.{ts,js}","/{test,spec,unit}{.,-,_}*.{ts,js}"]
[2022-01-12 09:42:01.739] [DEBUG] [KarmaTestListener]: Received Karma event: browser_process_failure
[2022-01-12 09:42:01.739] [ERROR] [KarmaTestRunProcessor]: Failure while listening for test events: Browser Failure - cannot start
[2022-01-12 09:42:01.739] [DEBUG] [KarmaTestRunProcessor]: Test error processing requested with message: Browser Failure - cannot start
[2022-01-12 09:42:01.739] [DEBUG] [KarmaTestListener]: Closing connection with karma
[2022-01-12 09:42:01.739] [INFO] [KarmaTestListener]: Cleaning up connections
[2022-01-12 09:42:01.741] [DEBUG] [PortAcquisitionManager]: Releasing ports: 9999
[2022-01-12 09:42:01.742] [ERROR] [DefaultTestManager]: System component terminated with message: Karma server failed to connect: Browser Failure - cannot start
[2022-01-12 09:42:01.742] [DEBUG] [DefaultTestManager]: Test action in progress (System stop was not requested) - Initiating system stop
[2022-01-12 09:42:01.742] [INFO] [DefaultTestManager]: Stopping test manager
[2022-01-12 09:42:01.742] [DEBUG] [DefaultTestManager]: Stopping karma event listener
[2022-01-12 09:42:01.742] [DEBUG] [KarmaTestListener]: Request to stop karma listener - Listener is still stopping
[2022-01-12 09:42:01.742] [ERROR] [DefaultTestManager]: Error: Karma server failed to connect: Browser Failure - cannot start
[2022-01-12 09:42:01.742] [INFO] [DefaultTestManager]: Stopping test manager
[2022-01-12 09:42:01.742] [DEBUG] [DefaultTestManager]: Stopping karma event listener
[2022-01-12 09:42:01.742] [DEBUG] [KarmaTestListener]: Request to stop karma listener - Listener is still stopping
[2022-01-12 09:42:01.744] [DEBUG] [KarmaTestListener]: Karma connection closed on port 9999
[2022-01-12 09:42:01.744] [DEBUG] [KarmaTestListener]: Done closing karma listener connection
[2022-01-12 09:42:01.744] [DEBUG] [DefaultTestManager]: Stopping karma server
[2022-01-12 09:42:01.745] [INFO] [KarmaTestServer]: Killing Karma server on port 9976
[2022-01-12 09:42:01.745] [INFO] [AngularTestServerExecutor:CommandLineProcessHandler]: Process rub60qo8lom - Killing process tree of PID: 17737
[2022-01-12 09:42:01.753] [DEBUG] [DefaultTestManager]: Karma server is already stopped
[2022-01-12 09:42:01.753] [INFO] [DefaultTestManager]: Stopped test manager
[2022-01-12 09:42:01.753] [ERROR] [Adapter]: Failed to load tests - Karma server failed to connect: Browser Failure - cannot start
[2022-01-12 09:42:01.753] [DEBUG] [Notifications]: Showing 'Error' notification with actions 'Retry Test Load' and message: Failed to load tests - Karma server failed to connect: Browser Failure - cannot start
[2022-01-12 09:42:01.754] [DEBUG] [Adapter]: Updating loaded test tree
[2022-01-12 09:42:01.754] [INFO] [Adapter]: Finished loading tests in 10.01 secs (Failed)
[2022-01-12 09:42:01.756] [DEBUG] [AngularTestServerExecutor:CommandLineProcessHandler]: Process rub60qo8lom - Successfully killed process tree for PID: 17737
[2022-01-12 09:42:01.802] [DEBUG] [AngularTestServerExecutor:CommandLineProcessHandler]: Process rub60qo8lom - PID 17737 exited with code '0' and signal 'null' for command: /tmp/fnm_multishells/17026_1641980140216/bin/node /home/je/workspace/vmlf-api/lambda/webapp/node_modules/@angular/cli/bin/ng test vmlf-webapp --karma-config=/home/je/.vscode-server/extensions/lucono.karma-test-explorer-0.4.0/dist/karma.conf --progress=false --no-watch
[2022-01-12 09:42:01.802] [DEBUG] [KarmaTestServer]: Karma server process terminated
[2022-01-12 09:42:01.802] [DEBUG] [PortAcquisitionManager]: Releasing ports: 9976
[2022-01-12 09:42:01.802] [DEBUG] [PortAcquisitionManager]: Releasing ports: 9222
[2022-01-12 09:42:01.802] [INFO] [KarmaTestServer]: Karma server on port 9976 killed
[2022-01-12 09:42:01.802] [INFO] [DefaultTestManager]: Stopped test manager
[2022-01-12 09:42:01.802] [DEBUG] [DefaultTestManager]: System is done stopping

Karma server:
12 01 2022 09:56:44.049:WARN [karma]: No captured browser, open http://localhost:9976/
12 01 2022 09:56:44.059:INFO [karma-server]: Karma v6.3.9 server started at http://localhost:9976/
12 01 2022 09:56:44.059:INFO [launcher]: Launching browsers KarmaTestExplorer_CustomLauncher with concurrency unlimited

12 01 2022 09:56:44.062:INFO [launcher]: Starting browser Chrome

12 01 2022 09:56:50.853:ERROR [launcher]: Cannot start Chrome
[0112/095644.296:ERROR:sandbox_policy_base.cc(356)] Failed to add sandbox rule. error = 2, subsystem = 0, semantics = 0, pattern = '\tmp\karma-11437954\Default\chrome_debug.log'
[0112/095644.304:ERROR:gpu_process_host.cc(962)] GPU process launch failed: error_code=2
[0112/095644.304:WARNING:gpu_process_host.cc(1274)] The GPU process has crashed 1 time(s)

DevTools listening on ws://127.0.0.1:9222/devtools/browser/7ea340ce-f4a8-4ebb-9466-a4d1b5be8e5b
[0112/095644.307:ERROR:sandbox_policy_base.cc(356)] Failed to add sandbox rule. error = 2, subsystem = 0, semantics = 0, pattern = '\tmp\karma-11437954\Default\chrome_debug.log'
[0112/095644.308:ERROR:simple_backend_impl.cc(79)] Failed to create directory: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\wasm
[0112/095644.308:ERROR:simple_backend_impl.cc(79)] Failed to create directory: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\js
[0112/095644.309:ERROR:simple_backend_impl.cc(79)] Failed to create directory: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\wasm
[0112/095644.309:ERROR:simple_backend_impl.cc(79)] Failed to create directory: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\js
[0112/095644.309:ERROR:simple_backend_impl.cc(734)] Simple Cache Backend: wrong file structure on disk: 1 path: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\wasm
[0112/095644.309:ERROR:simple_backend_impl.cc(734)] Simple Cache Backend: wrong file structure on disk: 1 path: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\js
[0112/095644.311:ERROR:sandbox_policy_base.cc(356)] Failed to add sandbox rule. error = 2, subsystem = 0, semantics = 0, pattern = '\tmp\karma-114379
54\Default\chrome_debug.log'
[0112/095644.313:ERROR:gpu_process_host.cc(962)] GPU process launch failed: error_code=2
[0112/095644.313:WARNING:gpu_process_host.cc(1274)] The GPU process has crashed 2 time(s)
[0112/095644.314:ERROR:sandbox_policy_base.cc(356)] Failed to add sandbox rule. error = 2, subsystem = 0, semantics = 0, pattern = '\tmp\karma-11437954\Default\chrome_debug.log'
[0112/095644.314:ERROR:simple_backend_impl.cc(79)] Failed to create directory: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\wasm
[0112/095644.314:ERROR:simple_backend_impl.cc(79)] Failed to create directory: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\js
[0112/095644.314:ERROR:simple_backend_impl.cc(79)] Failed to create directory: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\wasm
[0112/095644.314:ERROR:simple_backend_impl.cc(734)] Simple Cache Backend: wrong file structure on disk: 1 path: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\wasm
[0112/095644.314:ERROR:simple_backend_impl.cc(79)] Failed to create directory: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\js
[0112/095644.315:ERROR:simple_backend_impl.cc(734)] Simple Cache Backend: wrong file structure on disk: 1 path: C:\Program Files\Google\Chrome\Application\97.0.4692.71/tmp/karma-11437954\Default\Code Cache\js
[0112/095644.315:ERROR:gpu_process_host.cc(962)] GPU process launch failed: error_code=2
[0112/095644.315:WARNING:gpu_process_host.cc(1274)] The GPU process has crashed 3 time(s)
[0112/095644.315:ERROR:disk_cache.cc(185)] Unable to create cache
[0112/095644.315:ERROR:sandbox_policy_base.cc(356)] Failed to add sandbox rule. error = 2, subsystem = 0, semantics = 0, pattern = '\tmp\karma-11437954\Default\chrome_debug.log'
[0112/095644.315:ERROR:shader_disk_cache.cc(612)] Shader Cache Creation failed: -2
[0112/095644.315:ERROR:disk_cache.cc(185)] Unable to create cache
[0112/095644.315:ERROR:disk_cache.cc(185)] Unable to create cache
[0112/095644.316:ERROR:gpu_process_host.cc(962)] GPU process launch failed: error_code=2
[0112/095644.316:WARNING:gpu_process_host.cc(1274)] The GPU process has crashed 4 time(s)
[0112/095644.316:ERROR:sandbox_policy_base.cc(356)] Failed to add sandbox rule. error = 2, subsystem = 0, semantics = 0, pattern = '\tmp\karma-11437954\Default\chrome_debug.log'
[0112/095644.317:ERROR:gpu_process_host.cc(962)] GPU process launch failed: error_code=2
[0112/095644.317:WARNING:gpu_process_host.cc(1274)] The GPU process has crashed 5 time(s)
[0112/095644.317:ERROR:sandbox_policy_base.cc(356)] Failed to add sandbox rule. error = 2, subsystem = 0, semantics = 0, pattern = '\tmp\karma-11437954\Default\chrome_debug.log'
[0112/095644.317:ERROR:gpu_process_host.cc(962)] GPU process launch failed: error_code=2
[0112/095644.317:WARNING:gpu_process_host.cc(1274)] The GPU process has crashed 6 time(s)
[0112/095644.317:FATAL:gpu_data_manager_impl_private.cc(407)] GPU process isn't usable. Goodbye.

Please Provide the Following Information

  • OS: Windows 11 with WSL2
  • Environment: WSL2 project
  • Node Version: 17
  • VSCode Version: 1.63.2
  • Karma Version: 6.3.9
  • Frameworks: Angular 13 & Jasmine

@JonatanE When running on WSL2, chrome launcher should be launching the chrome installation that's in WSL2 but it seems to be trying to launch the chrome you've got installed in windows instead.

  • What are your karmaTestExplorer.browser and karmaTestExplorer.customLauncher config values?
  • What output do you get when you run which google-chrome in your WSL2 terminal?
  • Are you able to successfully launch chrome from your WSL2 terminal outside of VSCode, or do you also get errors?
  • What Linux flavor and version are you running in WSL2?

@JonatanE Closing due to no response. Please reopen if required.