Hello Karma Community, I have been trying to understand Karma and have a question. Hopefully someone can help. What I would like to do is have Karma open a custom HTML Page that i created myself, within this page I will use code from an API. Now with jasmine I would like to run tests against the code on the HTML Page. Maybe im understanding karma wrong, but is this possible? I have installed the plugin karmaHTML and it seems to load the html page with the chrome launcher, it flashes the page than disappears. It seems the context to the JS from the api is gone that was on the page so I can not test on the page. Am I Missing something? Did I misunderstand how Karma/Jasmine is supposed to work? Any help would be greatly appriciated.
@N3RDL1F3WOB_twitter if you're testing angularJS most of the time the elements you create are not actually put on the DOM so you don't see them. If you were to put them on document and debug you would see the result.
I don't recommend that though
because you'll need to clean that up
Hi all, I want to write unit tests for my http requests. I want to connect to the real server and test the real responses. How do I get started?
@codymikol Thank you for answering! I am not testing angularJS we build our own API for clients. And we would like to test our API. I have a custom HTML file that i load into karma where all of our API calls/setup is integrated and the idea was to test against those calls/setup. If I am understanding correctly than I would need pretty much a blank page, than setup all of our calls per Karma?
I would not use karma to test your API. What framework are you using for your API?
In an Angular application, is it possible to globally mock a component for tests or do I need to override it in each spec individually?
Hello Karma devs! Are you guys aware of the set-value NPM vulnerability? There has been a fix released for set-value for the vulnerability in its version 3.0.1.
We are using v4.1.0 of Karma and we are seeing the set-value vulnerability being reported through npm audit.
Hey @bradrich i created an issue karma-runner/karma#3338 and although he was a bit of an ass about it, one of the devs has released a new version that looks to fix the issue
Hello all! Anyone have a good Karma-Electron setup? Happy to share mine. I've got it running my TypeScript tests using karma-electron. I find it to be much better than Jest, because none of the DOM APIs are mocked (plus DOM APIs aren't missing like they are in Jest), and plus Node.js APIs are available too, so easy to test WebGL, Node servers, etc.
I got tired of Jest missing APIs, or for example trying to test some code that calls WebGL APIs and it simply doesn't work in Jest.
Why try to mock the DOM, when you can just test with real DOM? :)
Plus headless Electron runs great in Chrome OS, or on continuous integration setups.
And you can take snapshots of the pixels, for comparing to previous snapshots! Jest is quite lesser, just to give my opinion. :)
Hi Karma kids! I've just migrated from Karma 1.7 to 4.2. I've got the suite running, but now I oddly get inconsistent test runs. Totally different tests will fail on one run, and then pass on another. I've gone through the docs an wound the concurrency down to 1, but that hasn't helped. I was wondering if anyone had any suggestions?
That sounds like some kind of shared global state issue
I was thinking that, which is why I wound the concurrency down to 1!
It's a largeish suite. We've got 2.5k tests
aren't all tests still executed within the same global context? concurrency is about how many tests run at the same time
I was thinking the concurrency would stop the tests interfering with each other via that global context, if they were
i can't say for sure, but i'd be surprised if that's the case. You'd be re-initilizing the entire context for every one of your 2.5k tests
all kards on the table, i'm not a karma expert by any means, it just looks like a shared state issue. I wonder though if their is something in the change logs you could check that might tell you if something critical changed between versions
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.