question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

import/export statements are ignored

See original GitHub issue

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",

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
link89commented, Jul 23, 2020

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

1reaction
jogelincommented, Sep 1, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is import/export statement not working? - Stack Overflow
The way you are importing works only with default export/import. So there are two ways you can fix your code: changing the import...
Read more >
what is ignore=y in import n export - Oracle Communities
If you specify IGNORE=y, Import overlooks object creation errors when it attempts to create database objects, and continues without reporting ...
Read more >
Import Sets: How to check ignored records? - ServiceNow
So that accounts for 2 rows out of the 3 ignored. The next best thing I guess would be to look at the...
Read more >
Export and Import - The Modern JavaScript Tutorial
js' re-exports only named exports, but ignores the default one. If we'd like to re-export both named and default exports, then two statements...
Read more >
API - esbuild
Ignore annotations; JSX; JSX dev; JSX factory; JSX fragment; JSX import source; JSX side effects; Keep names; Legal comments; Log level; Log ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found