karma-runner / karma-runner/karma
Karma calls Jasmine twice.
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### 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.js` file
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
1. I run karma start from the console
2. Everything in the describe and it functions are called twice.
3. 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):

Contributor guide
Research direction
Start with the linked karma.config.js and reproduce the issue by running `karma start` with the provided describe/it example. Compare the console output with the expected single execution; done means each describe and it function runs once and the test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100