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

coverageDirectory should be specified by default #3955

Closed
TrySound opened this issue Jul 1, 2017 · 8 comments · Fixed by #3966
Closed

coverageDirectory should be specified by default #3955

TrySound opened this issue Jul 1, 2017 · 8 comments · Fixed by #3966

Comments

@TrySound
Copy link
Contributor

TrySound commented Jul 1, 2017

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

I have

  • package.json with "test": "jest --coverage" script
  • test/test.js
    and when I run test script I got coverage placed in test/coverage while I expect <rootDir>/coverage
    In different projects I got coverage in root dir and I don't know what is the reason for it.

What is the expected behavior?

More clean coverageDirectory default

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

[email protected]
yarn 0.24.5
windows@8

@thymikee
Copy link
Collaborator

thymikee commented Jul 3, 2017

Can you provide a repro?

@TrySound
Copy link
Contributor Author

TrySound commented Jul 3, 2017

I guess it's because some of my projects used process.chdir('test'). Forgot about it
Is it expected behavior then?

@thymikee
Copy link
Collaborator

thymikee commented Jul 3, 2017

No, I don't think so. @aaronabramov should we add this to install_common_globals?

@aaronabramov
Copy link
Contributor

i'm not sure why this can happen. coverageDirectory is always set from <rootDir> + coverage. The only way it can happen if rootDir is not specified explicitly and process.chdir is called before the config is read. this way rootDir will default to cwd

@TrySound
Copy link
Contributor Author

TrySound commented Jul 3, 2017

Why docs say it undefined?

@aaronabramov
Copy link
Contributor

actually.. right.
it checks for coverageDirectory here, and since it's undefined, istanbul uses its own default, which is process.cwd() + '/coverage'.

@thymikee i think we should have a default value for this option, since practically it can't be undefined

@TrySound
Copy link
Contributor Author

TrySound commented Jul 5, 2017

Nice. Thanks.

@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.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants