Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Running tests gives error "Can't find variable: QUnit" #127

Closed
CodingItWrong opened this issue Aug 30, 2016 · 5 comments
Closed

Running tests gives error "Can't find variable: QUnit" #127

CodingItWrong opened this issue Aug 30, 2016 · 5 comments
Labels

Comments

@CodingItWrong
Copy link

CodingItWrong commented Aug 30, 2016

On a new Ember application created with Ember-CLI 2.7.0, if I run ember test the tests pass. But if I ember install ember-cli-mocha and then run ember test again, I get seven failures that all look mostly like:

not ok 1 PhantomJS 2.1 - TestLoader Failures ember-cli-mocha-test/tests/app.jshint: could not be loaded
    ---
        message: >
            Can't find variable: QUnit
        stack: >
            http://localhost:7357/assets/tests.js:4:8
            exports@http://localhost:7357/assets/vendor.js:132:37
            requireModule@http://localhost:7357/assets/vendor.js:32:25
            require@http://localhost:7357/assets/test-support.js:14598:14
            loadModules@http://localhost:7357/assets/test-support.js:14590:21
            load@http://localhost:7357/assets/test-support.js:14620:33
            http://localhost:7357/assets/test-support.js:14490:20
        Log: |

Usually I use ember-cli-mirage with my Mocha tests as well, and when I install that, my tests all pass. I'm pretty new to Ember and I wasn't able to find a way to get the tests passing without installing Mirage.

Please let me know any other info I can provide to help!

@rwjblue
Copy link
Member

rwjblue commented Aug 30, 2016

I suspect you are getting trolled by the issue I reported here: ember-cli/ember-cli-jshint#15. Sadly, I haven't gotten time for the fix yet.

@CodingItWrong
Copy link
Author

Thanks for the info—sounds like a tricky one. Just wanted to make sure you knew about it!

@rwjblue
Copy link
Member

rwjblue commented Aug 30, 2016

The issue is with running ember test with ember-cli-qunit which caches the JSHint/ESLint generated test files, then changing the test framework being used. At this point the cached ESLint/JSHint tests do not invalidate and get regenerated, so when you run ember test again the generated test files are still using QUnit instead of Mocha.

The short term solution is to rm -rf node_modules && npm install, but obviously that sucks. I'll try to get the time to fix it properly within the next week.

@CodingItWrong
Copy link
Author

No worries, it's not holding me up—because I do use ember-cli-mirage and the issue doesn't come up when I'm using it (for reasons that are beyond my JS-fu), I'm not held up. And it's a sandbox app anyway 😇

@Turbo87 Turbo87 added the bug label Nov 10, 2016
@Turbo87
Copy link
Member

Turbo87 commented May 27, 2017

closing this issue in favor of ember-cli/ember-cli-jshint#15

@Turbo87 Turbo87 closed this as completed May 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants