Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running with --coverage has different test output #3549

Closed
jsdario opened this issue May 11, 2017 · 5 comments
Closed

Running with --coverage has different test output #3549

jsdario opened this issue May 11, 2017 · 5 comments

Comments

@jsdario
Copy link

jsdario commented May 11, 2017

Hi all,

At the beginning I though I just needed troubleshoointg help, but I think I have found a bug.
I first opened a question on stackoverflow: http://stackoverflow.com/questions/43910088/jest-error-running-a-file-with-idx-operator

Then I realized that no errors where prompted without coverage, so the test suite, babel configuration and everything else seems right.

This is the error that appears with --coverage option:

screen shot 2017-05-11 at 10 16 20

I think the output shouldn't differ with or without coverage and thus this must be a bug.

@thymikee
Copy link
Collaborator

Does it happen on Jest@20?

@jsdario
Copy link
Author

jsdario commented May 19, 2017

Sorry that it took a while for me to test on jest@20, just did and yes, the output is still different.

My issue started with [email protected] and jest@19
Latest test was [email protected] and jest@20
Node.js v7.4.0

@rogeliog
Copy link
Contributor

rogeliog commented Jun 7, 2017

This might be because Istanbul wraps your code in another function to calculate the coverage... facebook/idx#19 has more info, I'm closing in favor of facebook/idx#19

@rogeliog rogeliog closed this as completed Jun 7, 2017
@jsdario
Copy link
Author

jsdario commented Nov 29, 2017

In case someone else is looking for a suggestion / workaround:

I decided to use babel-plugin-idx only for production, since it's only supposed to be for a performance improvement

So with a .babelrc like the following you can avoid experiencing this issue, while profiting from idx

{
  "presets": [
    "flow",
    "react-native",
    "react-native-stage-0/decorator-support"
  ],
  "plugins": [
    "transform-inline-environment-variables"
  ],
  "env": {
    "production": {
      "plugins": [
        "idx",
        "transform-remove-console",
        "transform-inline-environment-variables"
      ]
    }
  }
}

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants