douglasduteil / isparta

:skull: A code coverage tool for ES6 (babel/6to5)
Do What The F*ck You Want To Public License
643 stars 47 forks source link

--include-all-sources doesn't appear to play nice with babel-core/register #110

Open 321ckatz123 opened 8 years ago

321ckatz123 commented 8 years ago

I have an ES6 Node application that uses babel-core\register to get things to work within Node. It is an API, so there is no webpack / browserify.

When I use the command

babel-node node_modules/isparta/bin/isparta cover --include-all-sources --report lcov --report html node_modules/mocha/bin/_mocha -- --recursive --

it only shows me my app.js in the coverage tools, which all it has is:

require('babel-core/register'); require('./server');

It looks like it's FINDING the other files when I do -v, but they are not in the actual coverage report (put below). I'm sure I'm just doing something dumb or not setting an option I need, but for the life of me Google and looking through the issues here didn't help me.

Additionally, if it helps, I have a basic mocha test that tests ONE file and if I don't specify --include-all-sources, that file is "covered" correctly, but, as expected, files that I don't have tests for don't show up.

Here is my current package.json as well

"dependencies": { "babel-core": "6.4.5", "babel-preset-es2015": "6.3.13", "babel-preset-stage-2": "6.3.13", "bluebird": "3.1.4", "body-parser": "1.14.2", "compression": "1.6.1", "continuation-local-storage": "3.1.4", "cors": "2.7.1", "dotenv": "2.0.0", "envalid": "0.2.0", "express": "4.13.4", "lodash": "4.0.1", "moment": "2.11.1", "redis": "2.4.2", "request-promise": "2.0.0" }, "devDependencies": { "chai": "3.5.0", "isparta": "4.0.0", "gulp": "3.9.0", "gulp-nodemon": "2.0.6", "mocha": "2.4.5" }

Using configuration

verbose: true instrumentation: root: . extensions:


Isparta options : { '0': 'cover', '--': [ '--recursive', '--' ], 'include-all-sources': true, verbose: true, report: [ 'lcov', 'html' ], cmd: 'node_modules/mocha/bin/mocha', : [ 'cover', 'node_modules/mocha/bin/mocha' ], excludes: [], include: [ '*/_.js', 'node_modules/mocha/bin/_mocha' ] } Preload C:\Source\hosted-react\api\app.js Module load hook: transform [C:\Source\hosted-react\api\app.js] Preload C:\Source\hosted-react\api\caching\redis.js Preload C:\Source\hosted-react\api\configuration\configuration.js Preload C:\Source\hosted-react\api\controllers\helpers.js Preload C:\Source\hosted-react\api\controllers\hockey\boxscore.js Preload C:\Source\hosted-react\api\controllers\hockey\post.js Preload C:\Source\hosted-react\api\controllers\hockey\scoreboard.js Preload C:\Source\hosted-react\api\controllers\hockey\standings.js Preload C:\Source\hosted-react\api\controllers\olympics\medals.js Preload C:\Source\hosted-react\api\controllers\olympics\participants.js Preload C:\Source\hosted-react\api\controllers\olympics\results.js Preload C:\Source\hosted-react\api\controllers\olympics\schedule.js Preload C:\Source\hosted-react\api\controllers\olympics\standings.js Preload C:\Source\hosted-react\api\controllers\olympics\teams.js Preload C:\Source\hosted-react\api\controllers\post\helpers.js Preload C:\Source\hosted-react\api\controllers\post\logger.js Preload C:\Source\hosted-react\api\controllers\post\postController.js Preload C:\Source\hosted-react\api\controllers\shared\clearCache.js Preload C:\Source\hosted-react\api\controllers\shared\injuries.js Preload C:\Source\hosted-react\api\controllers\shared\playerNews.js Preload C:\Source\hosted-react\api\controllers\shared\teams.js Preload C:\Source\hosted-react\api\controllers\shared\transactions.js Preload C:\Source\hosted-react\api\controllers\signature.js Preload C:\Source\hosted-react\api\gulpfile.js Preload C:\Source\hosted-react\api\processors\helpers.js Preload C:\Source\hosted-react\api\processors\hockey\boxscore.js Preload C:\Source\hosted-react\api\processors\hockey\events.js Preload C:\Source\hosted-react\api\processors\hockey\leaders.js Preload C:\Source\hosted-react\api\processors\hockey\matchupGaming.js Preload C:\Source\hosted-react\api\processors\hockey\scoreboard.js Preload C:\Source\hosted-react\api\processors\hockey\standings.js Preload C:\Source\hosted-react\api\processors\hockey\teamStats.js Preload C:\Source\hosted-react\api\processors\olympics\events.js Preload C:\Source\hosted-react\api\processors\olympics\medals.js Preload C:\Source\hosted-react\api\processors\olympics\participants.js Preload C:\Source\hosted-react\api\processors\olympics\phases.js Preload C:\Source\hosted-react\api\processors\olympics\schedule.js Preload C:\Source\hosted-react\api\processors\olympics\standings.js Preload C:\Source\hosted-react\api\processors\olympics\teams.js Preload C:\Source\hosted-react\api\processors\shared\decodes.js Preload C:\Source\hosted-react\api\processors\shared\injuries.js Preload C:\Source\hosted-react\api\processors\shared\odds.js Preload C:\Source\hosted-react\api\processors\shared\participants.js Preload C:\Source\hosted-react\api\processors\shared\playerNews.js Preload C:\Source\hosted-react\api\processors\shared\teams.js Preload C:\Source\hosted-react\api\processors\shared\transactions.js Preload C:\Source\hosted-react\api\processors\shared\winProbability.js Preload C:\Source\hosted-react\api\routes\routes.js Preload C:\Source\hosted-react\api\routes\sports\hockey.js Preload C:\Source\hosted-react\api\routes\sports\olympics.js Preload C:\Source\hosted-react\api\routes\sports\shared.js Preload C:\Source\hosted-react\api\server.js Preload C:\Source\hosted-react\api\services\helpers.js Preload C:\Source\hosted-react\api\services\hockey\boxscore.js Preload C:\Source\hosted-react\api\services\hockey\events.js Preload C:\Source\hosted-react\api\services\hockey\leaders.js Preload C:\Source\hosted-react\api\services\hockey\matchupGaming.js Preload C:\Source\hosted-react\api\services\hockey\scoreboard.js Preload C:\Source\hosted-react\api\services\hockey\standings.js Preload C:\Source\hosted-react\api\services\hockey\teamLeaders.js Preload C:\Source\hosted-react\api\services\hockey\teamStats.js Preload C:\Source\hosted-react\api\services\olympics\events.js Preload C:\Source\hosted-react\api\services\olympics\medals.js Preload C:\Source\hosted-react\api\services\olympics\participants.js Preload C:\Source\hosted-react\api\services\olympics\phases.js Preload C:\Source\hosted-react\api\services\olympics\schedule.js Preload C:\Source\hosted-react\api\services\olympics\standings.js Preload C:\Source\hosted-react\api\services\olympics\teams.js Preload C:\Source\hosted-react\api\services\post\helpers.js Preload C:\Source\hosted-react\api\services\post\hockey\boxscore.js Preload C:\Source\hosted-react\api\services\post\hockey\events.js Preload C:\Source\hosted-react\api\services\post\hockey\leaders.js Preload C:\Source\hosted-react\api\services\post\hockey\scoreboard.js Preload C:\Source\hosted-react\api\services\post\hockey\standings.js Preload C:\Source\hosted-react\api\services\post\olympics\events.js Preload C:\Source\hosted-react\api\services\post\olympics\medals.js Preload C:\Source\hosted-react\api\services\post\olympics\participants.js Preload C:\Source\hosted-react\api\services\post\olympics\schedule.js Preload C:\Source\hosted-react\api\services\post\olympics\standings.js Preload C:\Source\hosted-react\api\services\post\olympics\teams.js Preload C:\Source\hosted-react\api\services\post\shared\decodes.js Preload C:\Source\hosted-react\api\services\post\shared\injuries.js Preload C:\Source\hosted-react\api\services\post\shared\participants.js Preload C:\Source\hosted-react\api\services\post\shared\playerNews.js Preload C:\Source\hosted-react\api\services\post\shared\teams.js Preload C:\Source\hosted-react\api\services\post\shared\transactions.js Preload C:\Source\hosted-react\api\services\shared\decodes.js Preload C:\Source\hosted-react\api\services\shared\injuries.js Preload C:\Source\hosted-react\api\services\shared\odds.js Preload C:\Source\hosted-react\api\services\shared\participants.js Preload C:\Source\hosted-react\api\services\shared\playerNews.js Preload C:\Source\hosted-react\api\services\shared\teams.js Preload C:\Source\hosted-react\api\services\shared\transactions.js

Preload C:\Source\hosted-react\api\services\shared\winProbability.js

Writing coverage object [C:\Source\hosted-react\api\coverage\coverage.json]

Writing coverage reports at [C:\Source\hosted-react\api\coverage]

Write report: lcov Write report: html Writing C:\Source\hosted-react\api\coverage\index.html Writing C:\Source\hosted-react\api\coverage\api\index.html Writing C:\Source\hosted-react\api\coverage\api\app.js.html Write report: text-summary

Salakar commented 8 years ago

@321ckatz123 did you ever figure this out? I'm having the same problem at the moment, 100% coverage is nice, but I'd actually like to include more than just the entry file with babel-register 😆

image

321ckatz123 commented 8 years ago

@Salakar, not for this issue no. I started using gulp-jsx-coverage to do this though and that overcame some of the other issues I was having (but it still only showed coverage for files that had unit tests).

Additionally, I saw other bugs that basically said this repo's owner no longer wants to manage this and people are trying to take it over.