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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds
npm run coverage
script, which produces coverage output in two formats:text-summary
(to console) andhtml
(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:
master
, runnpm it
(ornpm 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.
npm t
, open those two urls again while the tests are running.Observe that the code of those two files is not instrumented.
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 ofcommon_test.js
is not — instrumentation of test files was explicitly disabled../coverage
dir with HTML output being created at the previous step.This change is