Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Doma
@SevenOutman

@SevenOutman: It is, and karma-browserstack-launcher is also used a fair bit. We use it at Wikimedia in a couple of projects. I think jQuery and QUnit also use it in their repos.

I'm having a hard time setting up karma-browserstack-launcher to run in GitHub Actions as recorded in rsuite/rsuite#1707. Can't have it running and can't find a running example either. Opened several issues but got no response.

Doma
@SevenOutman
Neither jQuery nor QUnit is using karma-browserstack-launcher. jQuery has karma-browserstack-launcher in their package.json as devDepencencies but is not using it. QUnit is using browserstack-runner.
Timo Tijhof
@Krinkle

@SevenOutman: I'm having a hard time setting up karma-browserstack-launcher to run in GitHub Actions as recorded in rsuite/rsuite#1707. Can't have it running and can't find a running example either. Opened several issues but got no response.

Aye, I'd recommend against parallel jobs in that way. That shouldn't be needed since karma manages concurrency for you already. If you must separate them, it'll require a stronger separation in the config. I also don't know if that might run into a quota limit. Afaik it allows many parallel browsers, but not sure if it can also allow the same number of parallel tunnels.

QUnit is using browserstack-runner.

Oops, that's my bad, yes. We don't use karma in the actual qunit repo right now, but that's only because karma-qunit imports the qunit module on its own, which is great, unless you are qunit itself, in which case that wouldn't test what we want it to test. I'll likely change that to use karma-tap at some point, and then naturally use karma-browserstack-launcher.

Naresh Yella
@nareshram:matrix.org
[m]
Disconnected (0 times)reconnect failed before timeout of 2000ms (transport close)
HeadlessChrome 75.0.3770 (Linux 0.0.0) ERROR
Disconnectedreconnect failed before timeout of 2000ms (transport close)
HeadlessChrome 75.0.3770 (Linux 0.0.0): Executed 1424 of 1515 (skipped 4) DISCONNECTED (32 mins 13.678 secs / 32 mins 5.586 secs)
HeadlessChrome 75.0.3770 (Linux 0.0.0) ERROR
Disconnectedreconnect failed before timeout of 2000ms (transport close)
HeadlessChrome 75.0.3770 (Linux 0.0.0): Executed 1424 of 1515 (skipped 4) DISCONNECTED (32 mins 13.678 secs / 32 mins 5.586 secs)
Can someone please help me to figure out what is the issue here
While running the tests on VM all looks good, but when we start the pipeline (Jenkins) we are seeing this error
Jon Ege Ronnenberg
@dotnetCarpenter
What does it say if you crank up the log level? logLevel: config.LOG_DEBUG,
Also I vaguely remember having issues with Chrome and the DISPLAY environment variable. What does echo $DISPLAY say?
kmgzc
@kmgzc
Hello, I am puzzled by update karma to 6.3.4(or event 6.0.0), my unit test with angularJS and jasmine cannot work well. Each time I do the 'karma start' command, there always comes up with some timeout error to me, event I add done() to afterEach. Is there something wrong with my test case?
kmgzc
@kmgzc
My jasmine.DEFAULT_TIMEOUT_INTERVAL is 5seconds and don't want to change it. I kindly ask for your guidence.
Cody Mikol
@codymikol
@kmgzc how long do your tests take to run?
kmgzc
@kmgzc

@kmgzc how long do your tests take to run?

The whole take about 4-5minutes, but the failure is more than 5 seconds.

Cody Mikol
@codymikol
You’ll either need to up your timeout interval, or make that test run faster than 5 seconds
Those are the only real options
Cody Mikol
@codymikol
It looks like you can also pass a timeout per “it” with jasmine/jasmine@68ba5b6
Doma
@SevenOutman

Aye, I'd recommend against parallel jobs in that way. That shouldn't be needed since karma manages concurrency for you already. If you must separate them, it'll require a stronger separation in the config. I also don't know if that might run into a quota limit. Afaik it allows many parallel browsers, but not sure if it can also allow the same number of parallel tunnels.

@Krinkle Thanks! I managed to run multi-browser tests in a single job. But there's one thing I can't achieve with single job is that it can't generate coverage separately for each browser (in case source code was executed differently in different browsers).

Timo Tijhof
@Krinkle
I believe karma-coverage takes care of that. Last I checked it stores the result of each browser in a separate sub directory like coverage/Firefox and coverage/Chromium. It might be that you have set the directory explicitly, in which case they could get overridden.
Doma
@SevenOutman

I believe karma-coverage takes care of that. Last I checked it stores the result of each browser in a separate sub directory like coverage/Firefox and coverage/Chromium. It might be that you have set the directory explicitly, in which case they could get overridden.

I see, thanks!

Kahn Le
@kahn_le_twitter
The Karma js was using the "ua-parser-js" package, The package has a security issue, Do you have a plan to change using the package to another for safety?
Andrew Jones
@aljones15
hey folks not sure why, but karma-coverage is not writing the html report to the dir specified. If I got into node_modules and manually tell exectureReport -> report.execute() then it does write the html, but I can't seem to find where the actual call is made to write the html report to a file with out me modifying karma-coverage.
basically istanbul reporter's write function is never being called
that helper is not firing for some reason
Andrew Jones
@aljones15
kdirIfNotExists
Andrew Jones
@aljones15
if anyone else runs into this: easiest way around it to not use karma-coverage and just another coverage reporter with the webpack instanbul loader.
Manny
@mannyluvstacos
Hi all! I wanted to bring awareness to a karma-runner/karma#3740 to protect from the security vuln introduced in 1.4.1.
If any maintainers have the time/capacity to review and merge, that would be greatly appreciated! :)
1 reply
kc_prom
@kc_prom:matrix.org
[m]

hey, quick question: I've got an angular 4 app I've inherited and while I got the tests consistently running and above 80% it takes 15+ min to run all the tests.

prior to doing any massive changes to optimize things i figured i would try for concurrency to see fi i could get a 2-3x multiplier to the speed.

I am using a recent version of Karma(6.3.4) and i notice that i should have some concurrency by default(infinity) even when i override that with an integer(3) i still only see one browser instance opening.

anyone have an idea what could cause the runner to not run concurrently?

bobby2004170
@bobby2004170
Hi Team,
I need to add tests for some project with uses a javascript 3d library that uses WebGL.I am using Karma test runner and using firefox headless mode . by default, the WebGl support was disabled in headless mode of the browser. Is there a way to enable WebGL in headless firefox mode?
Timo Tijhof
@Krinkle

@bobby2004170 The launcher for Firefox lives at https://github.com/karma-runner/karma-firefox-launcher. It seems WebGL was not disabled there, but rather it is (or was) disabled in upstream Firefox itself when in Headless mode, thus there is no way for us to enable it other than to launch "Firefox" instead of "FirefoxHeadless" (this should work locally but may require Xvfb in CI or other virtual contexts).

I do note that there is a bugzilla ticket for this, according to which WebGL is no longer disabled for Firefox on macOS and Windows as of Firefox 91 (released Aug 2021).

https://bugzilla.mozilla.org/show_bug.cgi?id=1635451
mozilla/gecko-dev@a8d8e90

Esteban Abaroa
@estebanabaroa
Anyone knows how I can use the debug package https://www.npmjs.com/package/debug with karma? You need to add localStorage.debug = 'something:*' and refresh the page, what would be the best way to do this with karma? Ideally it would add it before every test based on some env variable
Marvin Heilemann
@muuvmuuv
Hey Team, may I ask someone from the maintainers to replace my contributors email with a proper one or completly?
Michael Odumosu
@MOdumosu_twitter
Hey is anyone available I am trying to write a custom karma launcher for Microsoft edge and there is no clear guide or documentation on how this works can someone please help
Georg Lang
@georglang

Hi
I'm running karma start inside an angular 13 app and I get the following error :
You need to include some adapter that implements __karma__.start method!

dependencies have the following versions:

    "karma": "~6.3.17",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",

Can anyone help me, please ?

Michael Odumosu
@MOdumosu_twitter
you are not supposed to run karma start
@georglang
its npx ng test
angular is the framework and all your work should be done with the angular CLI (command line interface) that means you should have no business messing with its 3rd party packages or you are doing something wrong!! :)
who can I talk to about providing a karma runner for Microsoft edge?
Georg Lang
@georglang
@MOdumosu_twitter, sorry i started it with ng test and i got that message
Michael Odumosu
@MOdumosu_twitter
@georglang uninstall npm packages and reinstall, if that doesn't work check your karma.conf.js and make sure the plugins are state properly as in the template
Georg Lang
@georglang
@MOdumosu_twitter thanks for your answer, i tried reinstalling the packages multiple times but unfortunately with no success.
Here is my karma.conf.js:
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage'),
      require('@angular-devkit/build-angular/plugins/karma'),
      require('karma-jasmine-seed-reporter'),
    ],
    client: {
      jasmine: {
        // you can add configuration options for Jasmine here
        // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
        // for example, you can disable the random execution with `random: false`
        // or set a specific seed with `seed: 4321`
      },
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
    },
    jasmineHtmlReporter: {
      suppressAll: true, // removes the duplicated traces
    },
    coverageReporter: {
      dir: require('path').join(__dirname, './output/coverage/try'),
      subdir: '.',
      reporters: [{ type: 'html' }, { type: 'lcov', file: 'lcov.info' }],
    },
    reporters: ['progress', 'kjhtml', 'jasmine-seed'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false,
    restartOnFileChange: true,
    customLaunchers: {
      ChromeHeadless: {
        base: 'Chrome',
        flags: ['--headless', '--disable-gpu', '--remote-debugging-port=9222', '--no-sandbox'],
      },
    },
  });
};
Georg Lang
@georglang
I created a completly new project and copied the karma.conf.js into my project, also with no success
Georg Lang
@georglang
@MOdumosu_twitter And when i run the tests with 'ng test --source-map=false' the tests were executed
Michael Odumosu
@MOdumosu_twitter
@georglang yep javascript is a bad language I took out detectChanges from my code and some how it caused a expression_changed after checked error in another component!
Georg Lang
@georglang
@MOdumosu_twitter do you have any ideas ?
John Bumgardner
@johnbumgardner
hey guys not sure how active this chat is, but i had a dependabot vulnerability related to socket.io parser in karma. i opened a PR in karma to address it if yall could take a look