Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Initial coverage generation support (also: do not instrument normal tests) #1132

Merged
merged 2 commits into from
Jun 29, 2018

Conversation

ChALkeR
Copy link
Contributor

@ChALkeR ChALkeR commented Jun 29, 2018

This adds npm run coverage script, which produces coverage output in two formats: text-summary (to console) and html (detailed output written to ./coverage/ dir).

It does not introduce Travis + coveralls.io/codecov.io integration yet, this is just the first step aimed at getting coverage reports locally.

This also disables Istanbul instrumentation for all files during normal non-coverage tests, which were previously enabled for all tests.

To demonstrate the last clause:

  1. Check out master, run npm it (or npm install && npm run test), while the tests are running, open these two locations (adjust karma port if needed): http://localhost:9876/base/src/common.js and http://localhost:9876/base/src/common_test.js.
    Observe that the code is instrumented.
    Imo, that doesn't make much sense — coverage reporting seems to be disabled, coverage tests are also not used, and there seem to be performance warnings enabled.
  2. Check out this PR, run npm t, open those two urls again while the tests are running.
    Observe that the code of those two files is not instrumented.
  3. Check out this PR, run npm run coverage, open those two urls again while the tests are running.
    Observe that the code of common.js is instrumented while the code of common_test.js is not — instrumentation of test files was explicitly disabled.
  4. Observe the coverage summary and ./coverage dir with HTML output being created at the previous step.

This change is Reviewable

This adds `npm run coverage` script, which produces coverage
output in two formats: text-summary (to console) and html
(detailed output written to ./coverage/ dir).

It does not introduce Travis + coveralls.io/codecov.io integration yet,
this is just the first step aimed at getting coverage reports locally.

This also disables Istanbul instrumentation for all files during normal
non-coverage tests, which were previously enabled for all tests.
@ChALkeR
Copy link
Contributor Author

ChALkeR commented Jun 29, 2018

@dsmilkov
Copy link
Contributor

:lgtm_strong: Thanks! This looks very helpful!


Reviewed 2 of 2 files at r1.
Review status: :shipit: complete! 1 of 1 LGTMs obtained


Comments from Reviewable

@nsthorat
Copy link
Contributor

:lgtm_strong:


Review status: :shipit: complete! 2 of 1 LGTMs obtained


Comments from Reviewable

@nsthorat
Copy link
Contributor

This is great, thank you very much. 93% line coverage, not bad :)

@nsthorat nsthorat merged commit b7efcd9 into tensorflow:master Jun 29, 2018
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 this pull request may close these issues.

3 participants