douglasduteil / isparta

:skull: A code coverage tool for ES6 (babel/6to5)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

321ckatz123 opened this issue · comments

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:
- .js
default-excludes: true
excludes: []
embed-source: false
variable: coverage
compact: true
preserve-comments: false
complete-copy: false
save-baseline: false
baseline-file: ./coverage/coverage-baseline.json
include-all-sources: true
include-pid: false
es-modules: false
preload-sources: false
reporting:
print: summary
reports:
- lcov
- html
dir: ./coverage
watermarks:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
report-config:
clover: {file: clover.xml}
cobertura: {file: cobertura-coverage.xml}
json: {file: coverage-final.json}
json-summary: {file: coverage-summary.json}
lcovonly: {file: lcov.info}
teamcity: {file: null, blockName: Code Coverage Summary}
text: {file: null, maxCols: 0}
text-lcov: {file: lcov.info}
text-summary: {file: null}
hooks:
hook-run-in-context: false
post-require-hook: null
handle-sigint: false
check:
global:
statements: 0
lines: 0
branches: 0
functions: 0
excludes: []
each:
statements: 0
lines: 0
branches: 0
functions: 0
excludes: []


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

@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

@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.