babel-plugin-istanbul: import/export statements are ignored

Is it unexpected that this plugin appears to be ignoring import and export statements (in terms of statement and line counts)?

Maybe I have a config issue, but when I just use babel transpilation and the traditional instrumentation (left), it counts the import lines, but when I use this plugin (right), it doesn’t count them.

screen 20shot 20on 202017-10-16 20at 2011 3a56 3a09

The nyc config in my package.json:

"nyc": {
  "all": true,
  "checkCoverage": true,
  "perFile": true,
  "lines": 80,
  "reporter": [
    "text",
    "html"
  ],
  "include": [
    "server"
  ],
  "exclude": [
    "server/data/relayNode.js",
    "server/data/schema/",
    "server/data/mutations/",
    "server/data/generated/",
    "server/data/types/",
    "server/api/index.js",
    "server/data/models/index.js",
    "server/data/models/analytics/index.js",
    "server/data/events/cli.js",
    "server/lib/tomnodgbdx/scripts/workflowCli.js"
  ],
  "require": [
    "babel-register"
  ],
  "sourceMap": false,
  "instrument": false
}

My .babelrc:

{
    "sourceMaps": "inline",
    "presets": [
        "es2015-node",
        "stage-0"
    ],
    "plugins": [
        "transform-es2015-parameters",
        "transform-es2015-destructuring"
    ],
    "env": {
        "coverage": {
            "plugins": [
                "istanbul"
            ]
        }
    }
}

My relevant package.json scripts entries:

"unit": "BLUEBIRD_DEBUG=1 CONFIG=unit,unit2 mocha --recursive --require longjohn --require babel-register --require babel-polyfill tests/unit",
"coverage": "NODE_ENV=coverage nyc npm run unit",

Relevant package versions:

"babel-cli": "6.22.2",
"babel-core": "6.22.1",
"babel-eslint": "7.1.1",
"babel-plugin-transform-es2015-destructuring": "6.22.0",
"babel-plugin-transform-es2015-parameters": "6.22.0",
"babel-polyfill": "6.22.0",
"babel-preset-es2015-node": "6.1.1",
"babel-preset-stage-0": "6.22.0",
"babel-register": "6.22.0",
"babel-plugin-istanbul": "4.1.5",
"mocha": "3.2.0",
"nyc": "11.2.1",

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 6
  • Comments: 20 (1 by maintainers)

Most upvoted comments

We do have the same issue. That is very strange. Is there a way to also ignore the import statements in jest?

@VickyKoblinski I have the same issue, did you progress on it?

@fossage it’d be great to send a PR to that repo