Skip to content

Add mocha support and fix pretender bug - #119

Merged
RobbieTheWagner merged 7 commits into
ember-cli-code-coverage:masterfrom
mattmarcum:add-mocha-support
Sep 30, 2017
Merged

Add mocha support and fix pretender bug#119
RobbieTheWagner merged 7 commits into
ember-cli-code-coverage:masterfrom
mattmarcum:add-mocha-support

Conversation

@mattmarcum

Copy link
Copy Markdown
Contributor

This should address #2 and also fixes a bug I was seeing with the pretender passthrough/fake request not having a response property.

@apellerano-pw

Copy link
Copy Markdown

Thanks for working on this, I was just wondering why lcov wasn't regenerating when our mocha tests re-ran on the /tests endpoint of ember serve!

@mattmarcum

Copy link
Copy Markdown
Contributor Author

I found a different pretender bug....I finally figured out that some of my unit tests weren't tearing mirage down properly by calling window.server.shutdown(). Even though I had the passthrough enabled in my mirage configs, code coverage would never show up in the browser. It was failing silently because the request.onload function in the test-footer script was never getting called. I think this is a pretender bug caused by a new pretender instance being created multiple times and never being torn down.

@rwjblue

rwjblue commented Jun 2, 2017

Copy link
Copy Markdown
Collaborator

FWIW, pretender throws now if you create a second instance without shutting down the last

@mattmarcum

mattmarcum commented Jun 5, 2017

Copy link
Copy Markdown
Contributor Author

Is there anything I need to change about this PR? I noticed that it's failing travis ci builds for node v 0.12 - because ember-cli-htmlbars-inline-precompile isn't transpiled:

  `ember test`
/home/travis/build/kategengler/ember-cli-code-coverage/node_modules/ember-cli-htmlbars-inline-precompile/index.js:15
  init() {
      ^
Unexpected token (

But I think that's affecting every PR until that version of node is removed from the travis configs.

@paulcwatts

Copy link
Copy Markdown
Contributor

For what it's worth, #115 drops support for Node 0.12.

@mattmarcum

mattmarcum commented Jun 19, 2017

Copy link
Copy Markdown
Contributor Author

Anybody got any suggestions for the failing tests? When I run them locally with ember test on node v6 they all pass. There's an error in the travis console log that says an address is in use and I'm thinking that's the root cause.

@paulcwatts

Copy link
Copy Markdown
Contributor

@mattmarcum Are you running the tests through "npm test", instead of "ember test"? In those specific test cases, "ember test" is run through the node tests.

Those EADDRINUSE errors usually occur when a preceeding test fails, and the "ember test" child doesn't exit or hangs, so the next test runs "ember test" and the port is in use.

@mattmarcum

Copy link
Copy Markdown
Contributor Author

ok I ran them with npm test and they all (47) pass locally. I'll look some more when I get home.

@paulcwatts

Copy link
Copy Markdown
Contributor

The tests are also fairly flaky, as I've noticed. They can fail intermittently on Travis.

Matt Marcum and others added 2 commits June 21, 2017 10:19
[Fixes ember-cli-code-coverage#111] Update dependencies, get babel instrumenter working (ember-cli-code-coverage#115)

babel 6 fix
@mattmarcum

Copy link
Copy Markdown
Contributor Author

Yeah, I squashed my commits and pushed up and now the node v4 tests fail and the node v6 tests pass - the exact opposite of what was happening before - no code changes.

@RobbieTheWagner

Copy link
Copy Markdown
Collaborator

@mattmarcum seems the tests are a bit flaky, but I restarted them and they passed 🎉 . Going to go ahead and merge this in.

@RobbieTheWagner
RobbieTheWagner merged commit 7f9b961 into ember-cli-code-coverage:master Sep 30, 2017
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

Successfully merging this pull request may close these issues.

6 participants