Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Fernando Costa
@fadc80
I did some updates on karma-runner/karma#2699. Could somebody confirm if my conclusion is correct?
Diego Molina
@diemol
Hi all,
I'm trying to reach to the maintainers of https://github.com/karma-runner/karma-sauce-launcher, is any of them here in this room?
We have a PR open since a while ago and we'd love some feedback.
karma-runner/karma-sauce-launcher#164
Kyle Hoehns
@kylehoehns
Curious if anyone else has ran into this issue. We have about 2,100 tests and a while back we started noticing a random number of tests being ran during our CI builds. One run will be 700 tests and the next will be a separate set of 500 or 1000. Is there a way I can debug to see what files karma is grabbing and why only a subset of them are getting processed on a given run? We noticed this around the time our CI server updated from Chrome 75 to 76 but I'm not sure if that's making a difference.
Kyle Hoehns
@kylehoehns
Looks like it may be related to this karma-runner/karma#3352 .
raghanag
@raghanag
Hi All, I have the karma runner setup and it is giving and uncaught exception and failing without any erros i am using typescript
Karma-typescript for preprocessor
is there anything wrong in my tsconfig
Ilya Goncharov
@ilia_goncharov_twitter
Hello, is karma-teamcity-reporter is not supported already? And there are no plans to update it (including Pull Requests)?
magendirang
@magendirang
Hello All, I am working on an Angular 7.0.2 and I am using karma Jasmine for the unit tests. I have close to 3500 tests and it is being split into execute in 4 shards ChromeHeadless. One of the shards is always failing and rarely all 4 shards execution completes. The error I get does not give much information about what is wrong. Any help is really appreciated! 15:59:08 HeadlessChrome 0.0.0 (Linux 0.0.0) ERROR
15:59:08 {
15:59:08 "message": "An error was thrown in afterAll\n[object ErrorEvent] thrown",
15:59:08 "str": "An error was thrown in afterAll\n[object ErrorEvent] thrown"
15:59:08 }
15:59:08 HeadlessChrome 0.0.0 (Linux 0.0.0): Executed 65 of 921 (skipped 8) ERROR (44.243 secs / 44.164 secs)
magendirang
@magendirang
@lwensveen Hey I am running into the same error. Could you please share what you did to fix?
Zalezale
@Zalezale
where is the karma api doc
I want to know the meaning of “describle,it....”
Joe Pea
@trusktr
@Zalezale You're looking for either Jasmine, or Mocha.js + Chai.js. One of those provides the descript/it API. Karma itself doesnt provide that API, it only runs your tests.
SandeepNS12
@SandeepNS12
@Zalezale karma is just a task runner which runs your test cases
Joe Pea
@trusktr
Yep, and you can install karma-jasmine, for example, to get the describe/it APIs, but you don't necessarily have to install Jasmine specifically. 👉 https://jasmine.github.io
Zalezale
@Zalezale
but ,why karma can know api like describle,it if it do not contain the api
Joe Pea
@trusktr
I don't think it does. Maybe you have karma-jasmine or karma-chai installed (or something else).
You can run npm ls karma-chai or npm ls karma-jasmine to see if they are installed in your project.
Maybe you followed some tutorial, or maybe some default steps you followed automatically add karma-jasmine?
Zalezale
@Zalezale
yes ,you are right bro
I find the karma-chai at package.json
in fact i just want to find the doc intro the api like it ,describle, thanks
thank you very much
Joe Pea
@trusktr
no prob. In that case https://www.chaijs.com should help out.
kumaraswamyarun
@kumaraswamyarun
I was using jest for testing react components, but jest would not render c3 js or svg elements since it uses jsdom and jsdom is basic only, so I am switching to Karma, since it would run in browser although I am planning to run it in headless browser like phantom js, I think the charts will render using karma, am I correct in this?
kumaraswamyarun
@kumaraswamyarun
yes its working, since using chrome
Joe Pea
@trusktr
@kumaraswamyarun Yep! Hence why I use Karma too (I use karma-electron so that I have both Node.js and Chrome APIs available for tests)
meenanarendra
@meenanarendra
Hi All
How are you doing
I am looking for a solution to unit test javascript of a ASP .NET MVC website. I used Karma, Jasmine and RequireJs but getting error while running test cases
Is their any other way by which we can test this?
Joe Pea
@trusktr
Jest is an alternative to Karma.
electrofLy
@electrofLy
Hey! Do you guys have an idea why would karma connect multiple times to a browser, and just keep making a new connection and disconnecting the previous connection?
electrofLy
@electrofLy
@electrofLy It was because of having window.location.replace code execution in a karma test :P
Joe Pea
@trusktr
Ah
JamesDepret
@JamesDepret
Hi, I have a day pipe which translates the dates to daynames in user specific languages, but i don't know how to mock the service call
PIPE-FILE:
      //function...
      case 0:
        //calling the service here should return 'Sunday' in the appropiate language (this works)
       //I want to build a mock in my test for this: this.lang["core.shared.pipes.weekdays.sunday"]
        return this.lang["core.shared.pipes.weekdays.sunday"];

    }
  }

  get lang() : string {
    return this.language.lang;
  } 
  constructor(private language: AppLanguageService) {}
To test this i thought i had to do following, but this doesn't work:
TEST FILE FOR PIPE:
let mockLanguageService;

    beforeEach(() => {
        mockLanguageService = jasmine.createSpyObj(['lang'])

        TestBed.configureTestingModule({
            imports: [],
            declarations: [],
            providers: [
              {provide: AppLanguageService, useValue: mockLanguageService},
            ]
        });

        // this is wrong, how do I do this correctly?:
        mockLanguageService.lang.and.returnValue({
            ['core.shared.pipes.weekdays.monday']:    "monday",
            ['core.shared.pipes.weekdays.tuesday']:   "tuesday",
            // ...
        });
    })
JamesDepret
@JamesDepret
Nevermind I found it
TEST FILE:
mockLanguageService.lang = ({
            ['core.shared.pipes.weekdays.monday']:    "monday",
            ['core.shared.pipes.weekdays.tuesday']:   "tuesday",
            //...
        });
Alexander Reitzel
@FunTimeCoding
I'm trying to set up a sample project that lets me write modular JS code (either ES6 import/export or requirejs) with a test framework (possibly Jasmine), for websites, and using ChromeHeadless so I can run the same tests on CI.
It's a bit discouraging how much effort that seems to be. Maybe it's even too much effort.
I'd appreciate some advice, pointers, or confirmation that what I'm doing is not very feasible without extensive hacks, or even working examples that I haven't yet tried myself.
It would be really nice to be able to write unit-tested and code coverage measured JS code for websites, without much more overhead.
Cody Mikol
@codymikol
Why is it a lot of effort?
Alexander Reitzel
@FunTimeCoding
I find there are many tools which have been used over the years, and a lot of examples and documentation, and some libraries and frameworks fit together, but some things are just possible with this combination and some with that. It's a large amount of moving parts to consider.
Cody Mikol
@codymikol
If you find it overwhelming, I’d suggest cloning a nodejs starter repository
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