karma-runner / karma-runner/karma

Karma runs tests when ANY src/**/file has changed

Open
#2,517 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### Expected behaviour

Karma should run the tests only when watched files change.

### Actual behaviour

It runs the tests when ANY file inside my src folder has changed.

### Environment Details

- Karma version (output of `karma --version`): 1.3.0
- Relevant part of your `karma.config.js` file

```javascript
const webpackConfigTests = require('./webpack/config.tests');

module.exports = function init(config) {
config.set({
// ...config

// Files to load
files: [
'./webpack/tests.js',
{ pattern: './src/**/*.js', watched: true, served: false, included: false },
{ pattern: './src/**/*test.js', watched: true, served: false, included: false }
],

preprocessors: {
'./webpack/tests.js': ['webpack', 'sourcemap']
}
});
};

```

### Steps to reproduce the behaviour

1. Start karma with autoWatch option in true
2. modify a random `src/**/*.css` file, then save
3. karma run the test suite even though is not necessary

Contributor guide

Open the contributing guide

Research direction

Start with the watched file patterns in karma.config.js and reproduce the issue by changing a src/**/*.css file while autoWatch is enabled. Check how these patterns determine which changes trigger a run, then verify that CSS changes no longer run the suite while changes to the watched JavaScript files still do.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.