Karma calls Jasmine twice.
Expected behaviour
Karma calls jasmine tests once.
Actual behaviour
Everything in the describe and it functions are being called twice, causing some tests to fail.
Environment Details
- Karma version (output of
karma --version): 1.7.0 - Relevant part of your
karma.config.jsfile Not sure what is relevant so here is my entire file: https://gist.github.com/hpufo/2bb70a3e399ab0a486d39f67158b5567
I also tried this but the result was the same(If I set included to false, karma breaks):
files: [ { pattern: 'test/**/*.tsx', watched: false, served: true, included: true } ],
Steps to reproduce the behaviour
- I run karma start from the console
- Everything in the describe and it functions are called twice.
- Tests that calls helper functions calls it twice resulting in the wrong return and test failing
I have created a simple mock to display this problem:
function fillArray(len: number) {
const array = new Array(len);
for (let i = 0; i < len; i++) {
array.push(0);
}
return array;
}
describe('Karma', () => {
console.log('DESCRIBE');
it('runs a test and prints', () => {
const array = fillArray(1);
console.log(array.length);
expect(true).toBe(true);
});
});
Here is what the above outputs in my console(I am only including the interesting parts):

I haven't experienced this issue with a similar setup on the most recent version from master. Are you still experiencing this issue?
I can reproduce this issue with the Karma API. Karma 4.0.1, Karma-Chrome-Launcher 2.2.0.
See the MCVE for a bare minimum example: https://github.com/is-already-taken/karma-runs-twice-mcve