SupercovDocumentation

Documentation

Lines and branches

See which parts of your code ran during the tests.

JavaScript

Line and branch coverage are a useful starting point: they show which code your tests ran and which paths they took. Supercov collects both when it runs your test suite.

Line coverage

A covered line ran during at least one test. An uncovered line didn’t.

Ask your agent to inspect an uncovered line in context. It might be an error handler no test reaches, a useful case that’s missing, or code your application no longer uses. Those call for different changes.

Running a line doesn’t mean its result was checked. A test that calls a price calculation without asserting the total can still cover every line in the calculation. Assertion coverage looks at that next question.

Branch coverage

A decision can send execution down different paths. Branch coverage records which outcomes ran. For an if statement, tests might reach the true outcome but never the false one.

Several conditions can contribute to the same decision. Exercising both outcomes doesn’t necessarily test each condition’s effect. MC/DC measures that separately.

Check coverage yourself

You can read the same reports as your agent. From your project directory, wrap your usual test command, then open the latest run:

npx supercov -- npm test
npx supercov runs latest

Replace the test command after -- with yours. If Supercov isn’t installed, start with Installation.

Here is the coverage section from a small checkout example with only a valid-order test:

Coverage
  Lines      80.00% (4/5)
  Branches   50.00% (1/2)
  MC/DC      0.00% (0/2)

The test never reaches the code that denies checkout. To find the location, list the gaps and inspect the file:

npx supercov runs latest gaps --limit 5
npx supercov runs latest file src/session.js

This is the uncovered line from that file report:

 LINE  STATUS        SOURCE
    6  NOT COVERED   return { status: 'denied', total: 0 };

NOT COVERED means the line didn’t run. PARTIAL means it ran, but some behavior on that line remains untested. The file report explains those gaps; they can include individual conditions as well as unexecuted code.

To see a line’s source and execution evidence, including which tests reached it when that information is available:

npx supercov runs latest line src/session.js:3

Use your own file paths and line numbers. These excerpts come from recorded checkout examples, with separate runs for each language in the selector.

Choose the next test

Your agent can inspect coverage by file and line, and, where the runner supports it, see which tests already reach the code. Often the right change is an additional case in an existing test file, not a new test setup.

Coverage percentages use the source Supercov discovered for that run. If an important folder is absent, ask the agent to check the source scope before interpreting the score. A missing file is not the same as a file with no gaps.

Code that ran while no test was running, such as a server starting up, counts in the total but belongs to no test. A request your app gets from another process, like a webhook from a payment mock, belongs to the test that was running when it arrived, if only one was. With a server for each worker, only that worker’s tests count. The run summary says when tests were credited that way.

A Python, Ruby or Go server your browser tests start is measured too. Its coverage is a run of its own, and the browser run’s summary names it.

To compare progress, run the same full suite before and after the test change. See Reading the results for reviewing that comparison and understanding measurement limits.

Read more in the terminal

npx supercov docs coverage-model
npx supercov docs cli

These print the detailed guides included with your installed version. npx supercov docs lists the available topics; npx supercov runs latest --help lists the queries you can make against a run.