mochajs / mocha

☕️ simple, flexible, fun javascript test framework for node.js & the browser
https://mochajs.org
MIT License
22.59k stars 3.01k forks source link

🛠️ Repo: Compute in-browser test coverage numbers #2883

Open boneskull opened 7 years ago

boneskull commented 7 years ago

We have coverage numbers, but only in Node.js. I'd like to see the coverage numbers against tests run with Karma.

Gathering coverage from Karma seems fraught with peril.

I would entertain other suggestions to improve how we run browser-based tests. My only requirement is that the tests run in a strict browser-like environment--jsdom shenanigans or Electron won't do.

ScottFreeCode commented 7 years ago

I've been working on this in the multi-coverage branch.

Getting Coveralls to take reports from multiple build jobs in the same build turned out to be way easier than I thought. I wasted so many hours looking for a more complex solution because I didn't initially realize I could just apply COVERAGE=true to the whole build. That alone should increase the coverage somewhat as it will show branches taken in different Node versions; would be nice to get more such branches covered though (Windows, whatever other terminals we're handling).

After that, I looked into adding coverage to the browser runs. Here's what I found out.

Feel free to pull it down locally and experiment to confirm or deny any of the above and try to fix the bundle errors.

ScottFreeCode commented 7 years ago

(I should add that the multi-coverage branch is based off the CI fixes branch, for obvious reasons; the diff from master should get to be simpler once the CI fixes branch is merged, presumably...)

ScottFreeCode commented 7 years ago

Found and fixed what I'd screwed up; that branch is working now (modulo Sauce flakes), so I've submitted PR #2886 for it.