karma-runner / karma-runner/karma

Conflicting mime-type definitions do not overwrite any longer due to change in latest version of mime dependency. Causes Karma to crash.

Open
#2,702 1 comment 2 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

When using the mime object within a configuration, that the mime-type will be remapped as expected. For more information see the following:

https://karma-runner.github.io/latest/config/configuration-file.html

Section -> mime

### Actual behaviour

The node module `mime` has been updated to use facet priority in deciding whether to remap one mine-type to another. So some mime-types, most notably mime-types like `'text/x-typescript': ['ts','tsx']` which is used as an example in the config documentation, no longer remap. The way mime@1.3.5 decides precedence means that the default `.ts` extension will never be remapped from `'video/mp2t'` to `'text/x-typescript'`.

**This can cause karma to exit with an Error while loading!**

### Environment Details

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

```
mime: {
'text/x-typescript': ['ts','tsx']
},
```

### Steps to reproduce the behaviour

1. Update karma and it's dependencies which will move mime to version 1.3.5 because of the dependency `"mime": "^1.3.4",`
2. Run a Karma config that has a mime-type which conflicts with a default. For example: `'text/x-typescript': ['ts','tsx']`
3. Run Karma

### Additional information

To see the change in the mime project, you can look at Mime.prototype.define here:

https://github.com/broofa/node-mime/blob/master/mime.js

Notice the Facet discussion.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the shown karma.config.js mime mapping and inspect Karma's mime configuration handling together with the referenced mime dependency behavior. Done means conflicting extensions such as ts and tsx are remapped as configured and Karma no longer exits with an error while loading.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.