Comments (25)
I see you're installing Chrome in WSL, but then aliasing chrome and CHROME_BIN
to point to the Windows installation of Chrome instead of the one you've installed in WSL.
You can try one of the following:
- Remove / don't perform the following parts of your Chrome installation steps to see if that resolves the issue:
alias chrome='/c/Program Files/Google/Chrome/Application/chrome.exe' export CHROME_BIN=chrome
- Or if you prefer to keep the above, you can try removing it for just the extension by using the extension setting:
"karmaTestExplorer.envExclude": ["CHROME_BIN"]
- If those don't work or are not preferable, you can try telling the extension to run as if in a container (which will enable the
--no-sandbox
flag for Chrome):"karmaTestExplorer.containerMode": "enabled"
- The extension always launches the browser in headless mode by default, but launching the Windows installation of Chrome headlessly is not always supported from WSL. If that's the case here, you can tell the extension to launch in non-headless mode by using the extension setting:
"karmaTestExplorer.nonHeadlessModeEnabled": true
- If none of those work, you can have the extension launch Chrome exactly as from Karma, as that seems to be working for you on the command line (though this option may also remove your ability to debug tests with the extension, but you'll still be able to run them):
"karmaTestExplorer.browser": "Chrome"
from karma-test-explorer.
"karmaTestExplorer.envExclude": ["CHROME_BIN"] "karmaTestExplorer.containerMode": "enabled", "karmaTestExplorer.nonHeadlessModeEnabled": true "karmaTestExplorer.browser": "Chrome"
Try those options only one at a time, not all together.
from karma-test-explorer.
Sorry running ng test --browsers=chrome_no_sandbox is having same issue
If you are running into the same issue while running from the command line, then the issue is with your setup and not with the extension. I suspect if you do not alias chrome / CHROME_BIN
to point to the Windows installation of Chrome (instead of the one you've installed in WSL), then you should be able to remove all the extension settings you had above (including karmaTestExplorer.browser
) and the extension should work by default for both testing and debugging.
from karma-test-explorer.
Not sure if this is related, but I'm getting multiple errors and erratic behaviour in vscode after updating to the latest release (1.77.3), and I'm on Ubuntu 22.04.2 LTS. CPU goes to 100% and when I kill vscode and run top
I see a lot of tests still running. After completely uninstalling the extension it seems to be back to normal.
This is what I have about vscode:
Version: 1.77.3
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:16:52.732Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Linux x64 5.15.0-71-generic snap
Sandboxed: No
from karma-test-explorer.
@doantranthanh Can you also attach the logs from the Karma Server ...
output channel when the issue occurs.
Also, are you able to successfully run the tests directly from the command line in WSL, without VS Code?
from karma-test-explorer.
yeah sure
here is the log file
from karma-test-explorer.
yeah I can run directly from the command line with the following steps:
- Download and install Chrome:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb
- Add alias in .bashrc
alias chrome='/c/Program Files/Google/Chrome/Application/chrome.exe'
export CHROME_BIN=chrome
-
Reload .bashsrc
-
Run the command ng test --browsers=Chrome
-
Access to http://localhost:9876/
it is working but I want to run individual tests so I installed the extension. However, it does not work. I have no idea why.
Thank you
from karma-test-explorer.
The log you attached is the one for the extension, not for Karma. To get the Karma log, first set the karmaTestExplorer.karmaLogLevel
setting to debug
and re-open your project. Then when the issue occurs, switch to the Output
panel and expand the drop down on the right side, where you should see an item that starts with Karma Server
. Select it and the Karma Logs will be displayed. Here's an example screenshot:
from karma-test-explorer.
Sorry, here is the log.
Thank you
from karma-test-explorer.
I enabled 'karmaTestExplorer.enableExtension' but I found another error here
It looks like Chrome cannot start.
from karma-test-explorer.
I tried the following setting but it does not work.
"karmaTestExplorer.envExclude": ["CHROME_BIN"]
"karmaTestExplorer.containerMode": "enabled",
"karmaTestExplorer.nonHeadlessModeEnabled": true
"karmaTestExplorer.browser": "Chrome"
Here is the log
[2023-05-01 06:34:42.568] [INFO] [Main]: Activating Karma Test Explorer, v0.8.2
[2023-05-01 06:34:42.568] [INFO] [Main]: Creating file handler
[2023-05-01 06:34:42.568] [INFO] [Main]: Creating workspace configuration resolver
[2023-05-01 06:34:42.568] [INFO] [Main]: Creating project factory
[2023-05-01 06:34:42.568] [INFO] [Main]: Creating config change manager
[2023-05-01 06:34:42.569] [DEBUG] [ConfigChangeManager]: Creating config change subscription
[2023-05-01 06:34:42.569] [INFO] [Main]: Creating preference manager
[2023-05-01 06:34:42.569] [INFO] [Main]: Creating port acquisition manager
[2023-05-01 06:34:42.569] [INFO] [Main]: Creating multi-status display
[2023-05-01 06:34:42.569] [INFO] [Main]: Registering project selection command
[2023-05-01 06:34:42.570] [INFO] [Main]: Registering function execution command
[2023-05-01 06:34:42.570] [INFO] [Main]: Setting initial multi-project context
[2023-05-01 06:34:42.570] [INFO] [Main]: Setting multi-project context to: false
[2023-05-01 06:34:42.570] [INFO] [Main]: Processing initial workspace folders
[2023-05-01 06:34:42.570] [INFO] [Main]: Discovering projects for workspace folders: [
"/c/Projects/cirium-profiles/src/frontend"
]
[2023-05-01 06:34:42.571] [DEBUG] [ProjectFactory]: Inspecting workspace folder for testing: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.571] [DEBUG] [ProjectFactory]: Including projects in workspace folder '/c/Projects/cirium-profiles/src/frontend' - 'karmaTestExplorer.enableExtension' is set to true
[2023-05-01 06:34:42.571] [DEBUG] [ProjectFactory]: Including projects in workspace folder - One or more inclusion conditions were satisfied: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.573] [DEBUG] [SimpleFileHandler]: Reading file synchronously: /c/Projects/cirium-profiles/src/frontend/angular.json
[2023-05-01 06:34:42.575] [INFO] [ProjectFactory]: Using project type 'angular' (auto-detected) for workspace folder: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.575] [DEBUG] [ProjectFactory]: Angular projects found for workspace folder '/c/Projects/cirium-profiles/src/frontend': cirium-profiles
[2023-05-01 06:34:42.576] [DEBUG] [Main]: Last loaded projects: [
"/c/Projects/cirium-profiles/src/frontend"
]
[2023-05-01 06:34:42.576] [DEBUG] [Main]: Primary projects: []
[2023-05-01 06:34:42.576] [INFO] [Main]: Registering project: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.576] [INFO] [Main]: Activating adapter for project: /c/Projects/cirium-profiles/src/frontend (frontend: cirium-profiles)
[2023-05-01 06:34:42.585] [INFO] [Main]: Done activating adapter for project: /c/Projects/cirium-profiles/src/frontend (frontend: cirium-profiles)
[2023-05-01 06:34:42.585] [INFO] [Main]: Setting multi-project context to: false
[2023-05-01 06:34:42.586] [INFO] [Main]: Subscribing to config changes for workspace folder: /c/Projects/cirium-profiles/src/frontend
[2023-05-01 06:34:42.586] [INFO] [Main]: Subscribing for subsequent workspace folder additions and removals
[2023-05-01 06:34:42.992] [DEBUG] [PortAcquisitionManager]: Request for 1 port(s) at base port 9976 acquired: 9976
[2023-05-01 06:34:42.992] [TRACE] [PortAcquisitionManager]: Currently assigned ports: 9976
[2023-05-01 06:34:43.005] [DEBUG] [PortAcquisitionManager]: Request for 1 port(s) at base port 9999 acquired: 9999
[2023-05-01 06:34:43.005] [TRACE] [PortAcquisitionManager]: Currently assigned ports: 9976, 9999
[2023-05-01 06:41:10.089] [DEBUG] [PortAcquisitionManager]: Releasing ports: 9999
[2023-05-01 06:41:10.208] [DEBUG] [PortAcquisitionManager]: Releasing ports: 9976
But I got another log which is said that
[2023-05-01 06:41:10.209] [DEBUG] [KarmaTestServer]: Karma server on port 9976 killed
[2023-05-01 06:41:10.209] [DEBUG] [DefaultTestManager]: Stopped test manager
[2023-05-01 06:41:10.209] [DEBUG] [DefaultTestManager]: System is done stopping
[2023-05-01 06:46:02.428] [DEBUG] [NotificationHandler]: User selected 'Show Log' for 'Error' notification: Failed to load tests - Karma server failed to connect: Browser Failure - timeout (Click to show log)
And
------------------------------------
Karma Test Explorer: Launching Karma
------------------------------------
[2023-05-01 06:34:53.741] [DEBUG] [KarmaConfigLoader]: Loading Karma config: /c/Projects/cirium-profiles/src/frontend/karma.conf.js
[2023-05-01 06:34:54.594] [DEBUG] [KarmaConfigLoader]: Using requested karma browser: Chrome
01 05 2023 07:35:09.933:WARN [karma]: No captured browser, open http://localhost:9976/
01 05 2023 07:35:10.003:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9976/
01 05 2023 07:35:10.007:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
01 05 2023 07:35:10.013:INFO [launcher]: Starting browser Chrome
01 05 2023 07:36:40.014:WARN [launcher]: Chrome has not captured in 90000 ms, killing.
01 05 2023 07:36:40.030:INFO [launcher]: Trying to start Chrome again (1/3).
01 05 2023 07:38:10.031:WARN [launcher]: Chrome has not captured in 90000 ms, killing.
01 05 2023 07:38:10.045:INFO [launcher]: Trying to start Chrome again (2/3).
01 05 2023 07:39:40.046:WARN [launcher]: Chrome has not captured in 90000 ms, killing.
01 05 2023 07:39:40.062:INFO [launcher]: Trying to start Chrome again (3/3).
01 05 2023 07:41:10.063:WARN [launcher]: Chrome has not captured in 90000 ms, killing.
01 05 2023 07:41:10.079:ERROR [launcher]: Chrome failed 3 times (timeout). Giving up.
What do you think?
from karma-test-explorer.
also, as you can see in my karma.config.js. I have a custom launch browser which is
customLaunchers: {
chrome_no_sandbox: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--disable-gpu',
],
},
},
I tried to use that but it does not work
"karmaTestExplorer.envExclude": ["CHROME_BIN"]
"karmaTestExplorer.browser": "chrome_no_sandbox"
The issue is
[2023-05-01 07:02:23.816] [DEBUG] [KarmaConfigLoader]: Using requested karma browser: chrome_no_sandbox
01 05 2023 08:02:35.821:WARN [karma]: No captured browser, open http://localhost:9976/
01 05 2023 08:02:35.848:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9976/
01 05 2023 08:02:35.848:INFO [launcher]: Launching browsers chrome_no_sandbox with concurrency unlimited
01 05 2023 08:02:35.853:INFO [launcher]: Starting browser ChromeHeadless
01 05 2023 08:02:37.118:INFO [Chrome Headless 103.0.5058.0 (Linux x86_64)]: Connected on socket jwfgE4LP6g2kh0yiAAAB with id 2349155
01 05 2023 08:02:41.021:WARN [Chrome Headless 103.0.5058.0 (Linux x86_64)]: Disconnected (0 times) Client disconnected from CONNECTED state (transport close)
Chrome Headless 103.0.5058.0 (Linux x86_64) ERROR
Disconnected Client disconnected from CONNECTED state (transport close)
from karma-test-explorer.
"karmaTestExplorer.browser": "Chrome"
yeah I tried each option at a time but it does not work
from karma-test-explorer.
Without setting the CHROME_BIN
variable, are you able to successfully run the tests from the command line using the same custom launcher?
ng test --browsers=chrome_no_sandbox
from karma-test-explorer.
I got this error
Browser application bundle generation complete.
##teamcity[blockOpened name='JavaScript Unit Tests' flowId='']
01 05 2023 09:22:10.044:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9876/
01 05 2023 09:22:10.047:INFO [launcher]: Launching browsers chrome_no_sandbox with concurrency unlimited
01 05 2023 09:22:10.053:INFO [launcher]: Starting browser ChromeHeadless
01 05 2023 09:22:14.456:INFO [Chrome Headless 103.0.5058.0 (Linux x86_64)]: Connected on socket GTJs-cV6y174YQhkAAAB with id 31457210
01 05 2023 09:22:25.745:WARN [Chrome Headless 103.0.5058.0 (Linux x86_64)]: Disconnected (0 times) reconnect failed before timeout of 2000ms (transport close)
Chrome Headless 103.0.5058.0 (Linux x86_64) ERROR
Disconnected reconnect failed before timeout of 2000ms (transport close)
Chrome Headless 103.0.5058.0 (Linux x86_64) ERROR
Disconnected reconnect failed before timeout of 2000ms (transport close)
Chrome Headless 103.0.5058.0 (Linux x86_64) ERROR
Disconnected reconnect failed before timeout of 2000ms (transport close)
from karma-test-explorer.
let me try to update puppeteer. Here is the current versions
"karma": "^6.3.20",
"karma-chrome-launcher": "^3.1.1",
"karma-coverage": "^2.2.0",
"karma-jasmine": "^5.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"karma-teamcity-reporter": "^1.1.0",
"protractor": "~7.0.0",
"puppeteer": "^14.1.1",
from karma-test-explorer.
I tried to run with new puppeteer
ng test --browsers=chrome_no_sandbox
but i have same issue
from karma-test-explorer.
Ah if I run
npm rebuild
Then I can run successfully
ng test --browsers=chrome_no_sandbox
from karma-test-explorer.
YaY
It is working now with the following settings.
"karmaTestExplorer.logLevel" : "debug",
"karmaTestExplorer.envExclude": ["CHROME_BIN"],
"karmaTestExplorer.browser": "chrome_no_sandbox"
I can see the unit tests in my VS Code
So I am going to remove CHROME_BIN from my bashrc, and try to use the extension and will let you know if there are any issues
Thank you so much for your support
from karma-test-explorer.
I tried to run and debug a test but it does not work due to
2023-05-01 09:23:30.750] [ERROR] [DefaultTestManager]: System component terminated with message: Karma disconnected unexpectedly: Browser Error - Disconnected Client disconnected from CONNECTED state (transport close)
[2023-05-01 09:23:30.750] [DEBUG] [DefaultTestManager]: Test action in progress (System stop was not requested) - Initiating system stop
[2023-05-01 09:23:30.750] [DEBUG] [DefaultTestManager]: Stopping test manager
[2023-05-01 09:23:30.750] [DEBUG] [DefaultTestManager]: Stopping karma event listener
[2023-05-01 09:23:30.750] [DEBUG] [KarmaTestListener]: Request to stop karma listener - Listener is still stopping
[2023-05-01 09:23:30.750] [ERROR] [KarmaTestRunProcessor]: Could not capture Karma events - Test execution failed: Browser Error - Disconnected Client disconnected from CONNECTED state (transport close)
[2023-05-01 09:23:30.752] [ERROR] [KarmaTestExplorer]: Failed while running requested tests - Karma disconnected unexpectedly: Browser Error - Disconnected Client disconnected from CONNECTED state (transport close)
[2023-05-01 09:23:30.752] [DEBUG] [NotificationHandler]: Showing 'Error' notification with actions 'Retry Test Run' and message: Failed while running requested tests - Karma disconnected unexpectedly: Browser Error - Disconnected Client disconnected from CONNECTED state (transport close)
Why running ng test --browsers=chrome_no_sandbox
is working
Sorry running ng test --browsers=chrome_no_sandbox
is having same issue
Chrome Headless 112.0.5614.0 (Linux x86_64) ERROR
Disconnected reconnect failed before timeout of 2000ms (transport close)
from karma-test-explorer.
I think I can load the tests with the extension which is good.
However, I dont know what the grey icons mean. Can you explain?
Also, when I tried to run a single test it returns the following log
And when I tried to run the second time, I got the above issues.
What do you think? thanks
from karma-test-explorer.
I actually can run it with docker-compose command line. So basically, we build and start the frontend container and run ng lint && ng test --code-coverage
. I will try it tomorrow then and will let you know.
Thank you for your supports
from karma-test-explorer.
let me try.
My problem is that atm test is running well either inside container (I have a shell script to start a container and run ng test inside container) or run with Chrome browser with setup in .bashrc an alias which is point to chrome.exe in C drive, for example
- Download and install Chrome:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb
-
Add alias in .bashrc
alias chrome='/c/Program Files/Google/Chrome/Application/chrome.exe'
export CHROME_BIN=chrome -
run ng test --browsers=Chrome
Now I can run outside the container with above steps. But I dont know how to integrate with karma extension so I can run individual test in VScode.
from karma-test-explorer.
@digeomel Open a separate issue and provide all the relevant details. Be sure to provide a minimal reproduction project that shows the issue.
from karma-test-explorer.
@doantranthanh converting this to a discussion as it seems to be difficulties with your particular setup rather than an issue with the extension.
from karma-test-explorer.
Related Issues (20)
- If even 1 test fails, tests fail to load Test discovery failed: Process exited with non-zero status code 1 (Click to show log) HOT 8
- Cannot run new test - Another test operation is still running HOT 1
- Tests not loaded for default generated Angular 15 project HOT 9
- Tests not loaded for default generated Angular 15 workspace - follow up to issue #60 HOT 2
- Getting error Failed to load tests - Karma server failed to start: spawn npx karma ENOENT HOT 2
- Test Explorer not showing all tests when sharding tests HOT 2
- Debug hangs up if a breakpoint is set. HOT 13
- Unable to install extension HOT 2
- Support different browsers when using multiple projects HOT 8
- Can not run in Angular 11 HOT 1
- Cannot use karma.config.local.js HOT 6
- Nx support HOT 10
- Yarn PNP support HOT 1
- High CPU usage - vscode hangs when the extension is loaded HOT 1
- Configuring tests with more node memory HOT 2
- Cannot debug a test multiple times while in a container HOT 13
- Get error Uncaught ReferenceError: global is not defined HOT 1
- Angular debug tests only works first time then breakpoint ignored and then Another test operation is still running error occurs HOT 1
- Karma Test Explorer Fails to Show Tests Angular 8 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karma-test-explorer.