Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Cody Mikol
@codymikol
@iftee-hussain can you update karma-webpack to 5.0.0 and let me know what the results are?
2 replies
Tobias Andersen
@turbolego
ERROR: 'NG0303: Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'.'
Chrome  (Windows 10): Executed 27 of 210 (skipped 1) SUCCESS (0 secs / 0.609 secs)
ERROR: 'NG0303: Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'.'
Chrome  (Windows 10): Executed 69 of 210 (skipped 1) SUCCESS (0 secs / 1.995 secs)
ERROR: 'NG0304: 'mat-list' is not a known element:
1. If 'mat-list' is an Angular component, then verify that it is part of this module.
2. If 'mat-list' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.'
Chrome  (Windows 10): Executed 90 of 210 (skipped 1) SUCCESS (0 secs / 3.308 secs)
ERROR: 'NG0304: 'mat-list' is not a known element:
1. If 'mat-list' is an Angular component, then verify that it is part of this module.
ERROR: 'NG0304: 'mat-list-item' is not a known element:
1. If 'mat-list-item' is an Angular component, then verify that it is part of this module.
2. If 'mat-list-item' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.'
Chrome (Windows 10): Executed 90 of 210 (skipped 1) SUCCESS (0 secs / 3.308 secs)
ERROR: 'NG0304: 'mat-list-item' is not a known element:
1. If 'mat-list-item' is an Angular component, then verify that it is part of this module.

I have a bunch of errors in my console, and no way to figure out which file has which error.

Is there a way to add the file-name of the offending file where the error occurs?

I have upgraded to karma-jasmine 4.0.1.

Thanks! 😄

1 reply
Tobias Andersen
@turbolego

Errors i get:

  ErrorComponent
ERROR: 'NG0303: Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'.'
Chrome 88.0.4324.150 (Windows 10): Executed 27 of 210 SUCCESS (0 secs / 0.92 secs)
ERROR: 'NG0303: Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'.'
ERROR: 'NG0303: Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'.'
Chrome 88.0.4324.150 (Windows 10): Executed 27 of 210 SUCCESS (0 secs / 0.92 secs)
ERROR: 'NG0303: Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'.'
Chrome 88.0.4324.150 (Windows 10): Executed 28 of 210 SUCCESS (0 secs / 0.95 secs)

My spec file:

import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ErrorComponent } from './error.component';

describe('ErrorComponent', () => {
  let component: ErrorComponent;
  let fixture: ComponentFixture<ErrorComponent>;

  beforeEach(waitForAsync(() => {
    TestBed.configureTestingModule({
      declarations: [ErrorComponent]
    }).compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(ErrorComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});

ts-file:

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-error',
  templateUrl: './error.component.html',
  styleUrls: ['./error.component.css']
})
export class ErrorComponent implements OnInit {

  constructor() { }

  ngOnInit() {
  }

}

html-file:

<p>
  error works!
</p>

Why do i get an error about "mat-dialog-close" and "button" here?
Neither the ts-file, the html-file or the spec-file mentions "mat-dialog-close" or "button" ? 🤔

Mykola Khodan
@mkhodan
Hi guys, I found an issue un karma-runner/karma-coverage package and create a PR with fix, do you know who can I ask to review it?
Daniel Becroft
@danielbecroft
Hi, we're seeing a strange issue where tests are running twice inside of our CI build process.
The tests are being run with ng test --watch=false --code-coverage. Running the same command locally (on the same configuration) does not trigger a duplicate run.
ejnelson15
@ejnelson15
I'm running into an error while running a testbucket, using karma 6.3.2 on angular 11.2.12 (if the matters) "An error was thrown in afterAll" followed by "Uncaught SyntaxError: Cannot use import statement outside a module". I've a number of suggestions that I've found online with no luck. Any ideas on what the problem might be or tips on debugging problem in 'afterAll'?
I should also mention that the error that shows up in the browser is "Error during loading: Uncaught SyntaxError: Cannot use import statement outside a module in http://localhost:9876/base/test.ts?02d5c53632af01b47b1d6dc8ac5000ca33557447 line 3"
line 3 of that file is: 'import 'zone.js/dist/zone-testing';'
ejnelson15
@ejnelson15
hmm, just noticed that karma works on node.js 6.x 8.x and 10.x . I've got v14.15.5. :( .
ejnelson15
@ejnelson15
Still failing the same way with node.js 10.x
Doma
@SevenOutman
I wonder whether there's anyone out there maintaining karma-browserstack-launcher
Doma
@SevenOutman
Is the project still alive?
Doma
@SevenOutman
I guess either answer is NO
Timo Tijhof
@timotijhof:matrix.org
[m]
@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.
José Gomes
@jgomesmv
Hi there!
I left an angular component not declared in one of my unit tests
Now I receive this error on the spec report but I have no idea in which spec file it's happening:
ERROR LOG: 'NG0303: Can't bind to 'icon' since it isn't a known property of 'nb-icon'.'
Any idea on how to address this?
Thanks!
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