-->

Ember-cli: importing blanket.js causes test runner

2019-05-10 01:52发布

问题:

I'm currently using ember-cli with ember-qUnit for testing. I would also like to add code coverage results to the test output, so after some research blanketjs seemed the way to go. I installed blanket using:

npm install blanket

And moved the blanket folder into the ember-cli vendor folder. As I understand the way to import libraries is through the Brocfile.js which I am doing like so:

app.import('vendor/blanket/dist/qunit/blanket.js');

Using ember inspector it appears that blanket has been imported correctly, and the "enable coverage" checkbox has appeared at the top of the qUnit test results page. However the tests just hang and just say "running". No tests seem to run. When I use:

ember test -server

It says that it is "waiting for runners". Does anyone know what could be going wrong here?

I've looked around and it seems code-coverage with ember-cli is a tricky subject:

Ember CLI Code Coverage Reports

Thanks

回答1:

I installed it using ember-cli-blanket. I don't think you need to include it in your Brocfile.js, but instead import it in your tests/index.html after you import your test-support.js.

Blanket will probably make your runners hang for a big as it is essentially loading you entire app all over again.

For what it's worth, I haven't been able to get accurate test coverage using this method yet, but it's possibly user error.