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
Rather than try to understand the whole thing see how each piece works independent of the other
Alexander Reitzel
@FunTimeCoding
I had jasmine running in a nodejs environment before. Sort of.
I got confused when trying to use the same template project for both browser based and nodejs based projects
https://github.com/FunTimeCoding/java-script-skeleton/blob/develop/Gruntfile.js this one has most of the things I tried working with the browser part
namely: there is modular code that runs through browserify and gets included, and the code in my main class is being executed
but what doesn't work this way is the jasmine and requirejs are setup
Mahadevan
@karthic2914
Hi All
this is the first time I am joining this room
Cody Mikol
@codymikol
Welcome 👽
Mahadevan
@karthic2914

I have question in stack overflow for karma this is the first time iam using jasmine and karma

can some one please help me I am struggling lot

https://stackoverflow.com/questions/59704920/issue-in-karma-coverage-html-coverage-report-is-empy

Please help me
Mahadevan
@karthic2914
?
Aaron Gray
@AaronNGray
Anyone know how to use karma-fixture with TypeScript and TypeScript Unit Tests ? I think I have all the development files in place but 'fixture' does not seem to be visible like it is in plain JavaScript. The TypeScript compiler is compiling it fine and not complaining. I have tried using @types/karma-fixture but that does not seem to help.
Aaron Gray
@AaronNGray
OKay seem to have solved that !
Peter Sulatycke
@psulat
Does karma support CommonJs out of the box or must you bundle the code first (eg webpack)? I see there is an old karma-commonjs npm project. Are people still using that? I wish the karma document mentioned something about CommonJs. Thanks
mihneagafton
@mihneagafton
Hello everyone! if i have a test, so inside a "describe" element, i get some data trough require, how do i access given data inside each of my "it" statements without calling the endpoint multiple times?
through*
takinaga-dev
@takinaga-dev
Hi, I would like to use latest karama npm package without vulnerability. When is latest package published?
Elon Mallin
@elonmallin
Hi, does anyone know of a way to use karma interactively? I know the tests are meant to run without user interaction but I have an external device that I need to interact with to get real responses. I don't want to mock these responses.
Dave Bush
@DaveMBush
Even a pointer to someone's working implementation would work.
José Óscar
@oscar-joar

Hi all. I am getting crazy with an issue in my jasmine tests,
specifically when testing the drag & drop event.
It turns out that when I run my test specifying the parameter "--browsers=ChromeHeadless"
the "drop" event is not fired, and as a consequence its inner function either.
However when removing the parameter "--browsers=ChromeHeadless", everything works as a charm.

Do you have guys any idea what is happening? thanks :)

Ben Tilford
@btilford
I've got an issue with karma exiting with an error even though the tests ran. Disconnected (0 times), because no message in 5000 ms This happens for Chrome/Firefox headless or not as well as puppeteer. Any ideas what sort of things cause this?
I played around with captureTimeout: 5000, browserNoActivityTimeout: 5000, browserDisconnectTimeout: 5000, browserDisconnectTolerance: 1,
but none of those did anything other than make it faster/slower to error out
Jared McCannon
@jrmccannon
Does anyone have a good resource for adding karma and jasmine to an existing angular application?
Everything I've seen so far is using the CLI to spin up a new app
Dave Bush
@DaveMBush
@jrmccannon if it were me, I'd spin up a new app and copy and paste the differences into the existing app.
alanmfeldstein
@alanmfeldstein
I currently depend on karma@2.0.0 and am advised to stop using HttpModule and switch to HttpClientModule. I can't find any release notes for Karma. How do I select a release that does not require HttpModule?
dhanashri79
@dhanashri79
I have almost 5000 test cases and am running test cases in vsts but everytime i run test cases i get diffrent fail count or sometimes only partially it get run... guyes plz help me out
dhanashri79
@dhanashri79
karma is existing after running few test cases can any one knows this issue? Disconnected (0 times)reconnect failed before timeout of 210000ms (ping timeout)
ERROR
Disconnectedreconnect failed before timeout of 210000ms (ping timeout)
raghanag
@raghanag
Hi All, We are seeing a strange error when we run karma with Requirejs in Jenkins, this is an intermittent issue, I followed this guide, https://karma-runner.github.io/0.8/plus/requirejs.html but sometimes we see below error out of blue. The same error we see in different modules every time it fails. We were thinking that the requirejs is not completely loaded before our tests run. But the above doc says
// ask Require.js to load these files (all our tests)
    deps: tests,

    // start test run, once Require.js is done
    callback: window.__karma__.start
14:01:39  START:
14:01:39  16 06 2020 21:01:14.564:WARN [filelist]: All files matched by "/home/jenkins/atgpf/workspace/hello/packages/ui-components/node_modules/karma-typescript/dist/client/commonjs.js" were excluded or matched by prior matchers.
14:01:39  16 06 2020 21:01:15.830:INFO [compiler.karma-typescript]: Compiling project using Typescript 3.9.5
14:01:39  16 06 2020 21:01:29.343:INFO [compiler.karma-typescript]: Compiled 136 files in 12623 ms.
14:01:39  16 06 2020 21:01:33.193:INFO [karma-server]: Karma v4.4.1 server started at http://0.0.0.0:9876/
14:01:39  16 06 2020 21:01:33.193:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
14:01:39  16 06 2020 21:01:33.199:INFO [launcher]: Starting browser ChromeHeadless
14:01:39  16 06 2020 21:01:34.282:INFO [HeadlessChrome 80.0.3987 (Linux 0.0.0)]: Connected on socket ZayUg2CQyOR_jdX7AAAA with id 65385820
14:01:39  HeadlessChrome 80.0.3987 (Linux 0.0.0) ERROR
14:01:39    Uncaught Error: Script error for "jqueryui-amd/position", needed by: ojs/ojpopupcore
14:01:39    https://requirejs.org/docs/errors.html#scripterror
14:01:39    at node_modules/requirejs/require.js:143:9
14:01:39    
14:01:39    Error: Script error for "jqueryui-amd/position", needed by: ojs/ojpopupcore
14:01:39    https://requirejs.org/docs/errors.html#scripterror
14:01:39        at makeError (node_modules/requirejs/require.js:168:17)
14:01:39        at HTMLScriptElement.onScriptError (node_modules/requirejs/require.js:1738:36)
14:01:39  
14:01:39  Finished in 1.625 secs / 0 secs @ 21:01:35 GMT+0000 (Coordinated Universal Time)
14:01:39  
14:01:39  SUMMARY:
14:01:390 tests completed
Lodewijk Wensveen
@lwensveen
Is there any way for karma to tell you which files warnings originate from?
sKudum
@sKudum
Hi, I am trying to integrate saucelab into my angular application which is using travsci, I added one karma.sauce-config.js file application level with saucename,acesskey and browser detaisl, but am not sure how to run this to seee the test results in local as well as in saucelab. npm test is always excuting karma.config.js file
Lodewijk Wensveen
@lwensveen
For anyone wondering, if you run the tests inside an IntelliJ ide like webstorm it shows you which files the warnings originate from
Jochem Brouwer
@jochem-brouwer
Heya! I want to run a preprocessor in karma with handleBinaryFiles set to true but I don't understand how to configure this.

Tried this:

browserifyPreprocessor: { handleBinaryFiles: true, options: {handleBinaryFiles: true} }, (in karma.conf.js) but browserify still refuses to handle my binary files

Kacper
@Jingiel
Hello everyone :)
I have a problem with Karma in enterprise angular project (500k+ LOC). Karma starts the Chrome browser too early without waiting for the Angular compilation to complete, since the project isn't a small one it takes some time to compile. Chrome timeouts before the compilation is finished. :(
We had to workaround the issue with captureTimeout: 600000, but this solution is not too optimal.
Best case scenario Karma would wait till compilation completes and just then launch the browser. I wonder if such approach would be possible to implement? I had scanned through the Karma's source code, but didn't manage to find proper place to start mingling with.
I kindly ask for your guidence :D
Parker Mauney
@ParkerM
Howdy. Any idea when a release will be cut so this fix becomes available? karma-runner/karma#3565
Abhijeet Jain
@abhijeetj100

Hey guys,
I am facing an issue when trying to run unit tests locally.
I get the error saying:
"ChromeHeadless have not captured in 60000ms, killing."
Error screenshot

It runs fine on Jenkins, and this happens for every project on my system.

Running these tests for projects written using Vue+Typescript.

Any suggestions as to what can be done here?

PS: Apologies if I posted at the wrong place, new here. In that case pls let me whom should I reach out to.

Thanks

Lucio Messina
@melfnt
Hi, I have an issue: I have an Angular11 application in which I set up a web-worker that use a typescript file as target. This works flawlessly if I run the application in the browser but when I run the tests Karma cannot find the script (web browser returns 404). I saw that similar issues were solved if the script is a javascript file, but what about typescript? Here you can find more details about my issue: https://stackoverflow.com/q/65585067/9277537
iftee-hussain
@iftee-hussain
@abhijeetj100 I am facing the same issue but the opposite. It fails in jenkins but works ok locally
Cody Mikol
@codymikol
@abhijeetj100 @iftee-hussain what version of karma-webpack are you using?
iftee-hussain
@iftee-hussain
@codymikol
    "karma": "^5.2.3",
    "karma-chrome-launcher": "^3.1.0",
    "karma-coverage": "^2.0.3",
    "karma-jasmine": "^1.1.1",
    "karma-jasmine-diff-reporter": "^2.0.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-sourcemap-loader": "^0.3.8",
    "karma-spec-reporter": "0.0.32",
    "karma-webpack": "^4.0.2",
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.