Closed u241kw42 closed 2 years ago
@uraikwar were you able to figure it out?
Hi @jginsburgn,
Yes, I figured it out.
Karma launches the browser as a subprocess and consumes its input and output/err stream. So, technically there is no hook is provided that we can use to print the browser's debug log in the console without modifying the karma's code.
One of the good options could be to print the browser's debug log in a file instead of the console. This can be done by setting an environment variable CHROME_LOG_FILE for the file location.
process.env['CHROME_LOG_FILE'] = '/opt/chrome/chrome_debug.log'; // or by setting the env at OS level before running Karma.
and launcher config looks like this:
defaultConfig.customLaunchers["ChromeWithLogs"] = {
base: "Chrome",
flags: ["--enable-logging=stderr", "--v=1"]
};
Thanks for sharing!
I am looking for a custom Chrome launcher configuration that can help me to capture Chrome Debug logs in the console.
The below command works fine when running from the terminal, I can see all Chrome's debug logs on Console. google-chrome --user-data-dir=/tmp/karma-85063679 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling --disable-renderer-backgrounding --disable-device-discovery-notifications --enable-logging=stderr --v=1 2>&1 https://www.google.com
However, when I created a custom launcher configuration. The same command is generated by karma-chrome-launcher however I cannot see any Chrome debug logs in the console.
What I am missing?