Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing assertionInjector disables the whole test module #8

Closed
lolmaus opened this issue Sep 10, 2015 · 10 comments
Closed

Importing assertionInjector disables the whole test module #8

lolmaus opened this issue Sep 10, 2015 · 10 comments

Comments

@lolmaus
Copy link
Contributor

lolmaus commented Sep 10, 2015

Simply doing

import { assertionInjector } from '../assertions';

results in the whole module disappearing from QUnit test results.

Imgur

@bcardarella
Copy link
Member

@lolmaus what version of ember-cli are you using? This is clearly bad

@lolmaus
Copy link
Contributor Author

lolmaus commented Sep 10, 2015

Ember CLI 1.13.8
Ember 2.1.0-beta.2
ember-qunit 0.4.10
qunit 1.19.0
ember-cli-qunit 1.0.1

@bcardarella
Copy link
Member

Thank you, I'll try updating our test suite for that set. Will report back soon

@lolmaus
Copy link
Contributor Author

lolmaus commented Sep 10, 2015

🙇

@rwjblue
Copy link

rwjblue commented Sep 10, 2015

It might be an invalid import which would result in an error when the test modules are loaded, but with your ember-cli-qunit version this error should be notated with a failing test (this is done here).

@lolmaus
Copy link
Contributor Author

lolmaus commented Sep 10, 2015

@rwjblue You're right:

TestLoader Failures: exam-sim-ember/tests/unit/models/exam-session-test: could not be loaded
Error: Could not find module exam-sim-ember/tests/unit/assertions

I'm doing import { assertionInjector } from '../assertions';.

This doesn't look right, but neither does this.

@rwjblue
Copy link

rwjblue commented Sep 10, 2015

Seems correct to me.

You added one extra level since your test is at tests/unit/models/exam-session-test.js, you would need to import { assertionInjector } from '../../assertions';.

@rwjblue
Copy link

rwjblue commented Sep 10, 2015

You could also use import { assertionInjector } from '<your app name>/tests/assertions'; if you didn't want to deal with the annoyance of the tracking down the right number of ../ to add when importing.

@rwjblue
Copy link

rwjblue commented Sep 10, 2015

As an aside, I'm pretty happy that ember-cli-qunit is giving you exactly what you need to fix this via a failing test. For quite a while errors thrown while evaluating the module (like invalid imports) caused the whole test module to be completely ignored with no indication of any failure.

@lolmaus
Copy link
Contributor Author

lolmaus commented Sep 10, 2015

It didn't help me because there was no assertions file at that path, so it was pretty magical to me.

lolmaus added a commit to lolmaus/ember-cli-custom-assertions that referenced this issue Sep 10, 2015
bcardarella added a commit that referenced this issue Jul 28, 2017
README.md: clarification on import path, fixes #8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants