karma-runner / karma-runner/karma
Allow for different configuration for different instances of the same preprocessor
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
(This is a feature request, not a bug, but I'll try to match the template as best I can)
### Expected behavior
Given a preprocessor `'foo'`, that is activated for more than one glob like so:
``` javascript
preprocessors: {
'**/*.a': ['foo'],
'**/*.b': ['foo']
}
```
It would be beneficial to be able to pass different configuration for the preprocessor running on *.a files, and the one running on *.b files.
### Actual behavior
You can only pass one configuration object (or at least, that's what the docs + examples I've seen says)
Currently, the only option to do this is if the preprocessor explicitly coded for that ability, and they would need to reimplement Karma's glob expansion and matching, as well as match Karma's precedence rules.
### Enviroment Details
- Karma version (output of `karma --version`): 0.13.19
- Relevant part of your `karma.config.js` file
``` javascript
springMessagesPreprocessor: {
options: {
suffix: "define([], getMessages );"
}
},
```
As you can see, I can only pass one configuration object that would be called for all runs of the preprocessor, even on different globs.
---
WDYT? Is this a hassle to implement? I'm willing to give it a shot with a PR (if you tell me ± where to go)
cc @dudabone
Contributor guide
Research direction
Start with the preprocessor configuration shown in karma.config.js, then trace how glob keys and shared options are expanded and passed to each preprocessor. Compare this path with the documented configuration examples; done means the *.a and *.b registrations can receive different options without requiring each preprocessor to implement glob matching.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100