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

collectCoverageOnlyFrom documentation is not clear #1536

Closed
gaearon opened this issue Aug 31, 2016 · 10 comments
Closed

collectCoverageOnlyFrom documentation is not clear #1536

gaearon opened this issue Aug 31, 2016 · 10 comments
Assignees
Milestone

Comments

@gaearon
Copy link
Contributor

gaearon commented Aug 31, 2016

screen shot 2016-08-31 at 21 56 51

Why is this an object representing a set of files? What is the format of this object? Why is it not an array? What are types of its keys and values? Does it have to include “files” as the docs say, or can those be folders too? Would specifying it automatically enable collectCoverage or does it only have effect when collectCoverage is enabled?

@cpojer
Copy link
Member

cpojer commented Aug 31, 2016

Oh yeah, you are right, this isn't great. Would you mind sending a PR with an update?

See https://github.com/facebook/jest/blob/master/package.json#L47 for an example. It's also mentioned here: http://facebook.github.io/jest/blog/2016/09/01/jest-15.html#rewritten-code-coverage-support

@gaearon
Copy link
Contributor Author

gaearon commented Aug 31, 2016

Is OnlyFrom removed completely?

@cpojer
Copy link
Member

cpojer commented Aug 31, 2016

Oh wait, no, sorry. I mixed it up. collectCoverageFrom is used to generate code coverage from all files, even untested ones.

collectCoverageOnlyFrom literally takes a list of files and only collects coverage for those.

The two options are mutually exclusive.

@gaearon
Copy link
Contributor Author

gaearon commented Aug 31, 2016

Are their inputs arrays of globs in both cases?

@cpojer
Copy link
Member

cpojer commented Aug 31, 2016

No, collectCoverageFrom is the only option that accepts globs currently (it is completely new). collectCoverageOnlyFrom literally only accepts direct, full paths, to files. It is used internally and an ugly leftover of darker times.

@aaronabramov
Copy link
Contributor

aaronabramov commented Sep 6, 2016

collectCoverageOnlyFrom has the format that looks like this:

{
  "file1.js": true,
  "file2.js": false
}

there was a reason to implement it this way for the internal runner, but for the outside world it probably makes no sense. should we remove it from the docs?

@cpojer
Copy link
Member

cpojer commented Sep 6, 2016

Probably, yes. collectCoverageFrom should be able to handle this use case.

@cpojer cpojer added this to the 15.2.0 milestone Sep 15, 2016
@cpojer
Copy link
Member

cpojer commented Sep 15, 2016

@DmitriiAbramov would you mind adding docs for collectCoverageFrom and removing collectCoverageOnlyFrom from the docs? I consider it internal and deprecated.

@aaronabramov
Copy link
Contributor

will do

@cpojer cpojer closed this as completed Sep 17, 2016
@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 14, 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