From 6aad9749d2b5203faf164cc33328174047c287e8 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Sat, 10 Jul 2021 06:52:31 +0800 Subject: docs(manual): split testing into multiple chapters (#11067) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartek IwaƄczuk --- docs/testing/coverage.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docs/testing/coverage.md (limited to 'docs/testing/coverage.md') diff --git a/docs/testing/coverage.md b/docs/testing/coverage.md new file mode 100644 index 000000000..0899c7cbd --- /dev/null +++ b/docs/testing/coverage.md @@ -0,0 +1,36 @@ +# Test coverage + +Deno will collect test coverage into a directory for your code if you specify +the `--coverage` flag when starting `deno test`. + +This coverage information is acquired directly from the JavaScript engine (V8) +which is very accurate. + +This can then be further processed from the internal format into well known +formats by the `deno coverage` tool. + +```bash +# Go into your project's working directory +git clone https://github.com/oakserver/oak && cd oak + +# Collect your coverage profile with deno test --coverage= +deno test --coverage=cov_profile + +# From this you can get a pretty printed diff of uncovered lines +deno coverage cov_profile + +# Or generate an lcov report +deno coverage cov_profile --lcov > cov_profile.lcov + +# Which can then be further processed by tools like genhtml +genhtml -o cov_profile/html cov_profile.lcov +``` + +By default, `deno coverage` will exclude any files matching the regular +expression `test\.(js|mjs|ts|jsx|tsx)` and only consider including specifiers +matching the regular expression `^file:` - ie. remote files will be excluded +from coverage report. + +These filters can be overridden using the `--exclude` and `--include` flags. A +module specifier must _match_ the include_regular expression and _not match_ the +exclude_ expression for it to be a part of the report. -- cgit v1.2.3