karma-runner / karma-runner/karma
Feat(?) Add option to update files between each run based on callback
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Expected behaviour
When I run karma watch with webpack, I use a `test-bundler.js` file as described in `karma-webpack` to define which tests I run. Within that file I often update which files to bundle by updating the regexp that filters files (see https://github.com/webpack-contrib/karma-webpack/blame/master/README.md#L88).
What I would like to do is to be able to parse the output of karma-reporter-json and update the regexp dynamicly to just run the tests that failed until there are no failing tests - preferably to modify the files part of the karma config so that I just ran a single testfile through webpack instead of webpack & karma using ~10-15 s to rebuild after a slight change.
### Actual behaviour
I have not found a way to change `files` or between tests.
### Environment Details
- Karma version: 2.0.9
- Relevant part of your `karma.config.js` file
```
const karmaConfig = {
basePath: '../',
browserConsoleLogOptions: { level: 'log', format: '%b %T: %m', terminal: true },
files: [
'node_modules/sinon/pkg/sinon.js',
testBundler
],
singleRun: !argv.watch,
usePolling: false,
autoWatchBatchDelay: 300,
frameworks: [
'mocha',
'chai'
],
preprocessors: {
[testBundler]: ['webpack', 'sourcemap']
},
reporters: ['mocha', 'json'],
browsers: ['ChromeHeadless'],
webpack: webpackConfig,
}
```
Contributor guide
Research direction
Start with test-bundler.js and the files/preprocessors section of karma.config.js; trace how karma watch invokes webpack and consumes karma-reporter-json output. Define the callback or update point between runs, then verify that changing the selected regexp reruns only the intended tests and reaches a no-fail run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100