karma-runner / karma-runner/karma

karma.conf.js generated by Karma CLI leads to "Mismatched anonymous define() modules error" when using requirejs and qunit

Open
#1,808 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

To reproduce the bug please look into [this repository](https://github.com/jjkavalam/karma-requirejs-qunit-karmacli-bug)

In my specific case, I am trying to run Karma with `requirejs`, `qunit` frameworks.

Importantly, am using the karma.conf.js generated by `karma init` **without any modifications**.

But `karma init` wrongly places `requirejs` after `qunit` in the `frameworks` parameter of `karma.conf.js`.

```
// ... Does not work !! Generated by "karma init"
frameworks: ['qunit', 'requirejs'],
// ...

```

This results in the error [Mismatched anonymous define() modules](http://requirejs.org/docs/errors.html#mismatch) . The problem can be fixed by flipping the order.
i.e.

```
// ... This works !!
frameworks: ['requirejs', 'qunit'],
// ...
```

A detailed discussion can be found in the repository [stated above](https://github.com/jjkavalam/karma-requirejs-qunit-karmacli-bug).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.