karma-runner / karma-runner/karma
Non cached files are not preprocessed
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
I noticed this because I'm using rollup (+ babel) to transpile ES2015 tests into ES5. With the 'default' configuration, tests are transpiled but then cached, so when I change the source, the cached version is served.
### Expected behavior
Using
_karma.conf.js_
``` js
module.exports = function(config) {
config.set({
files: [
{ pattern: 'test/*.js', nocache: true }
],
preprocessors: {
'test/**/*.js': ['rollup']
}
```
I expect test files to run through the preprocessor and not being cached.
### Actual behavior
Files are not cached, but are not even processed
### Enviroment Details
- Karma version (output of `karma --version`): 1.1.1
The logic is defined around [these lines](https://github.com/karma-runner/karma/blob/master/lib/file-list.js#L180-L187) and introduced in [this commit](https://github.com/karma-runner/karma/commit/6ef7e7b1546ff3e80a0369ea69c33625858a1e7a).
Clearly the intent of the committer (@nmalaguti) was to avoid preprocessing, but I feel like `nocache` is now serving two purposes
1. don't cache the file
2. don't preprocess
In my use case I'd like to have use (1.) without (2.), best of both worlds would be to have
```
{ pattern: '*.js', included: Boolean, watched: Boolean, served: Boolean, nocache: Boolean, preprocess: Boolean }
```
Contributor guide
Research direction
Start in lib/file-list.js around lines 180-187 and review the linked commit to understand how nocache currently affects preprocessing. Reproduce the behavior with the provided karma.conf.js and Rollup/Babel setup; done means nocache files are preprocessed while remaining uncached.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript, rollup
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100