karma-runner / karma-runner/karma
Glob Brace Expansion Doesn't Work For `config.files`
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
I want to run & preprocess files for the following extensions:
- `.cjs`
- `.js`
- `.jsx`
- `.mjs`
- `.ts`
- `.tsx`
I can accomplish this with a single `preprocessors` entry, but I need at least two `files` entries.
```js
config.set({
// ... other config
files: [
{pattern: 'src/**/*.test.[jt]s?(x)', watched: false}, // js | jsx | ts | tsx
{pattern: 'src/**/*.test.[cm]js', watched: false} // cjs | mjs
],
preprocessors: {
'src/**/*.test.{[jt]s?(x),[cm]js}': ['webpack'], // All 6 extensions
},
})
```
Setting aside the unlikelihood of any single project ever needing to work with all these extensions: **as far as I can tell, brace expansion seems to be disabled for `files`. Is this intentional or a bug?**
[The docs](http://karma-runner.github.io/4.0/config/files.html) don't say anything on the matter, one way or the other, though I'm leaning towards this is bug thanks to the following:
> ... all the patterns will get resolved into files using glob, so you can use minimatch expressions
Both Glob and Minimatch have support for brace expansion.
I've been digging around in the code to try to get more information, but I'm not yet sure I have the correct files to dive deeper into.
Contributor guide
Assessment
This issue has not been assessed yet.