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

HTML report on live meteor package testing is empty #23

Closed
cgalvarez opened this issue Sep 8, 2016 · 4 comments
Closed

HTML report on live meteor package testing is empty #23

cgalvarez opened this issue Sep 8, 2016 · 4 comments

Comments

@cgalvarez
Copy link

Expected Behavior

I expect to see the same HTML coverage report when I run spacejam-mocha --coverage \"out_coverage\" ./ (manually navigating to .coverage/index.html)

Current Behavior

The HTML report shown when navigating to localhost:3000/coverage while command COVERAGE=1 meteor test-packages ./ --driver-package practicalmeteor:mocha is empty:

html_coverage_route

Possible Solution

No idea.

Steps to Reproduce (for bugs)

  1. Go to your meteor package folder.
  2. Run the command COVERAGE=1 meteor test-packages ./ --driver-package practicalmeteor:mocha.
  3. Open your browser and navigate to localhost:3000/coverage.

IMPORTANT: you must have properly configured the meteor packages lmieulet:meteor-coverage and practicalmeteor:mocha in the file package.js (section Package.onTest()) of your package.

Context

I wanted to check the package coverage while writing my tests and seeing my tests results.

Your Environment

@cgalvarez
Copy link
Author

@serut The readme.md states that I should invoke Meteor.sendCoverage() from the browser console, but when testing a package with COVERAGE-1 meteor test-packages ./ --driver-package practicalmeteor:mocha, the Meteor object is not available as a global because Meteor is not running itself.

Do you know if there is some hook/way to execute code right after mocha test runner has finished testing? Maybe you've seen something in this package or spacejam that could help me to write a PR for this. I've been digging into both projects' code but still not found anything.

@serut
Copy link
Owner

serut commented Sep 12, 2016

I don't think so, I think that mocha has hooks like afterTestsDone but I didn't look at it. If you want to check the client coverage, my favorite way would be with spacejam --coverage out_html. Spacejam uses that code to save the client coverage on the server, if it can help:
https://github.com/serut/spacejam/blob/windows-suppport-rc4/lib/phantomjs-test-in-console-with-coverage.coffee#L90-L97

@cgalvarez
Copy link
Author

Thank you very much for your insights, @serut. I thought about mocha hooks too (the hook you refer is each).

I already saw that code. spacejam works well, but what I'm trying to achieve is doing the coverage analysis on each meteor live reloading. When you execute meteor test-packages ./ --driver-package practicalmeteor:mocha, you get a live reload at localhost:3000 anytime you change a package file, whether it's a functional or a test file.

What takes more time to execute spacejam is spawning meteor each time and compiling the code, but with the live reload, that gets faster. That's why I want to update the contents of the output folder after each live reload (which executes your package tests). This feature could be called live coverage 😄, and I think it would be very handy get live testing results and live coverage. I'll dig into practicalmeteor:mocha code to see if this can be achieved someway.

Thanks anyway!!

@cgalvarez
Copy link
Author

I'm closing this because of #30. After checking the new readme.md I noticed that I was missing the --settings part, which makes the coverage watch working.

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

2 participants