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

test: exclude write-coverage from coverage report #15194

Closed
wants to merge 1 commit into from

Conversation

bcoe
Copy link
Contributor

@bcoe bcoe commented Sep 5, 2017

With a goal of pitching in/familiarizing myself with the Node.js codebase, I wanted to help inch test coverage towards 100%.

With this in mind, I noticed that write-coverage.js is not tested. Since this is a utility used for outputting test coverage reports it seemed appropriate to add this to a list of excluded files (this just became possible).

In this pull request:

  • I've added a .nycrc configuration file, which can be used to configure the nyc test coverage tool.
  • I've added an exclude rule that removes write-coverage.js from coverage reports.
  • I've pulled reporter configuration into the .nycrc config file (I also added the additional text reporter, which I find provides useful high-level information for folks playing the test-coverage MMORPG).
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test, coverage

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. meta Issues and PRs related to the general management of the project. labels Sep 5, 2017
Copy link
Member

@TimothyGu TimothyGu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for stopping by!

While these changes mostly LGTM, I would encourage you to look at our commit message guidelines, and it would be awesome if you could modify the commit messages to conform to those guidelines. If not, we'll fix them upon landing.

.gitignore Outdated
@@ -13,6 +13,7 @@
!.gitkeep
!.mailmap
!.remarkrc
!.nycrc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alphabetical order

@@ -0,0 +1,6 @@
{
"exclude": [
"**/internal/process/write-coverage.js"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the wildcard necessary? It'll always be in lib/internal/process, unless the absolute path is used for comparison?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimothyGu because the Makefile passes an absolute path for the test coverage's working directory:

--temp-directory "/Users/benjamincoe/bcoe/node/.cov_tmp"

nyc ends up working with the path:

/Users/benjamincoe/bcoe/node/lib_/internal/process/write-coverage.js when the file is processed by the exclude glob.

tldr; we definitely don't want to bake /Users/benjamincoe/bcoe into the exclude rule, and it seemed like prefixing with the ** was the easiest solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcoe Makes sense 👍

@bcoe bcoe changed the title test: exclude write-coverage.js from test-coverage report test: exclude write-coverage.js from coverage report Sep 5, 2017
@bcoe bcoe changed the title test: exclude write-coverage.js from coverage report test: exclude write-coverage from coverage report Sep 5, 2017
@bcoe bcoe force-pushed the nyc-config branch 2 times, most recently from 3a1e6fe to 13f6400 Compare September 5, 2017 06:34
Added a .nyrc configuration file that can be used to configure
test coverage.

Added an exclude rule that removes write-coverage.js from coverage
reports.

Pulled reporter configuration into .nycrc and added an additional
text reporter.
@bcoe
Copy link
Contributor Author

bcoe commented Sep 5, 2017

@TimothyGu I think I've amended my commits appropriately; Is the test prefix reasonable for this? Wasn't quite sure what was appropriate given I'm not modifying code within a specific subsystem).

@TimothyGu
Copy link
Member

@bcoe Either test or build should be appropriate for this, build more so probably though.

"exclude": [
"**/internal/process/write-coverage.js"
],
"reporter": ["html", "text"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does adding the "text" reporter here affect the default output ? Just wondering if results on https://coverage.nodejs.org/ will be affected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhdawson I don't think it should; text will result in a nice summary being written to the terminal, for the user who just ran tests. html results in an index.html (etc) being written to the ./coverage folder, which I believe is what is in turn used on coverage.nodejs.org.

@addaleax I think I'm correct on this one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that sounds right to me :)

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mhdawson
Copy link
Member

mhdawson commented Sep 6, 2017

@bcoe thanks for improving the coverage output :)

@mhdawson
Copy link
Member

mhdawson commented Sep 6, 2017

@BridgeAR
Copy link
Member

BridgeAR commented Sep 8, 2017

@bcoe congratulations to your first commit to Node.js! 🎉

Landed in e9442d1

@BridgeAR BridgeAR closed this Sep 8, 2017
BridgeAR pushed a commit that referenced this pull request Sep 8, 2017
Added a .nyrc configuration file that can be used to configure
test coverage.

Added an exclude rule that removes write-coverage.js from coverage
reports.

Pulled reporter configuration into .nycrc and added an additional
text reporter.

PR-URL: #15194
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Sep 10, 2017
Added a .nyrc configuration file that can be used to configure
test coverage.

Added an exclude rule that removes write-coverage.js from coverage
reports.

Pulled reporter configuration into .nycrc and added an additional
text reporter.

PR-URL: #15194
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Sep 10, 2017
MylesBorins pushed a commit that referenced this pull request Sep 11, 2017
Added a .nyrc configuration file that can be used to configure
test coverage.

Added an exclude rule that removes write-coverage.js from coverage
reports.

Pulled reporter configuration into .nycrc and added an additional
text reporter.

PR-URL: #15194
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Sep 12, 2017
Added a .nyrc configuration file that can be used to configure
test coverage.

Added an exclude rule that removes write-coverage.js from coverage
reports.

Pulled reporter configuration into .nycrc and added an additional
text reporter.

PR-URL: #15194
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
addaleax pushed a commit to addaleax/node that referenced this pull request Sep 13, 2017
Added a .nyrc configuration file that can be used to configure
test coverage.

Added an exclude rule that removes write-coverage.js from coverage
reports.

Pulled reporter configuration into .nycrc and added an additional
text reporter.

PR-URL: nodejs#15194
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins
Copy link
Contributor

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if no let me know or add the dont-land-on label.

@bcoe
Copy link
Contributor Author

bcoe commented Sep 20, 2017

@MylesBorins my plan was to continue working on a few coverage related issues in my spare time; the answer to your question depends; are we comfortable with moving the main branch towards higher coverage, without inching up the coverage on v6? This might be my temptation, just because it will become a bit of a hassle to keep back-porting all these minor changes to the test/build process, I could be convinced otherwise though (CC: @addaleax, @TimothyGu?).

I don't yet have the commit bit on Node, so I think I might need to lean on the kindness of strangers to add that additional label 😛

@MylesBorins
Copy link
Contributor

@bcoe backporting the minor changes are not a huge hassel as long as we maintain a small delta.

@MylesBorins
Copy link
Contributor

ping re: backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants