# Measuring test coverage

Description: Hardhat 3 Tutorial - Measuring test coverage

Note: This document was authored using MDX

  Source: https://github.com/NomicFoundation/hardhat-website/tree/main/src/content/docs/docs/tutorial/coverage.mdx

  Components used in this page:
    - <Run cmd="..."/>: Runs a command in the terminal with npm/pnpm/yarn.
    - :::tip: A helpful tip callout block. Supports custom title `:::tip[Title]` and icon `:::tip{icon="name"}` syntax.

import Run from "@hh/Run.astro";

Hardhat 3 has built-in test coverage functionality to help you identify untested code. It works with Solidity tests by default, and with the `hardhat-toolbox-viem` plugin, it also works with [`node:test`](https://nodejs.org/api/test.html) tests.

## Getting code coverage for Solidity tests

Generate a coverage report for your Solidity tests:

<Run command="hardhat test solidity --coverage" />

The output shows a coverage summary at the end. A Markdown report is printed to the terminal, while LCOV and HTML reports are generated in the `coverage` folder.

## Getting code coverage for TypeScript tests

Generate a coverage report for your TypeScript tests:

<Run command="hardhat test nodejs --coverage" />

## Getting combined code coverage

Get combined coverage for both Solidity and TypeScript tests:

<Run command="hardhat test --coverage" />

:::tip
Learn more about test coverage in [our coverage guide](/docs/guides/testing/code-coverage).
:::
