Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To get meaningful code coverage with Cypress, instrument the application code during its build, collect the resulting coverage data with @cypress/code-coverage, then use the report to add tests for important uncovered behavior. Cypress does not instrument application code automatically. “Complete” means covering the code and behaviors in the scope you choose—not automatically reaching 100% across every file.

Decide what “complete coverage” means for your project

Coverage measures which instrumented statements, branches, functions, and lines ran during tests. It does not prove that your assertions are correct or that a test would catch a regression. Decide what code belongs in the report before configuring instrumentation.

  • Frontend source: the usual starting point for browser end-to-end (E2E) or component tests.
  • Backend source: include it only if the server is separately instrumented and its counters are made available to the collector.
  • Test files: unit-test specs can be covered with additional configuration; they are not included merely because application coverage works.
  • Dependencies: normally exclude third-party code such as node_modules, along with generated files and test files unless they are intentionally in scope.

Coverage percentages describe execution within that chosen scope. A high score can coexist with weak assertions, while a lower score can reveal a small number of important untested business rules or error paths.

Choose instrumentation for your build system

Cypress’s test runner collects coverage counters; your application’s build or transpilation step must add them. Choose the approach that matches the toolchain rather than combining all three.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Approach Best fit Important considerations
NYC instrumentation A separate instrumentation step that writes instrumented output to a distinct directory. Make the test server serve the instrumented build. Cypress’s example is npx nyc instrument --compact=false src instrumented; the flag makes generated code easier to inspect.
Babel with Istanbul Projects that transpile application code with Babel. Enable babel-plugin-istanbul in the Cypress build environment. Avoid enabling it globally if Jest already instruments the same files, which can duplicate counters.
Vite with vite-plugin-istanbul Applications built or served by Vite, including Cypress component testing with Vite. Set include/exclude patterns and extensions to match the source. Vue single-file components may require .vue; TypeScript may require .ts. An environment gate such as requireEnv: true and VITE_COVERAGE=true can restrict instrumentation to coverage runs.

Keep instrumentation limited to Cypress runs when other test tools use their own instrumentation. Configure source maps so report paths resolve to original source files, and inspect the report to confirm that the files you intended to measure are present. With Istanbul instrumentation, the running application exposes counters on window.__coverage__.

Install the collector and register its Cypress task

Install @cypress/code-coverage as a development dependency, then configure both sides of Cypress: the support file imports the browser-side collector, and the Node event setup registers the task that writes coverage data.

  1. Install the package: run npm install --save-dev @cypress/code-coverage in the project.
  2. Import the support module: add import '@cypress/code-coverage/support' to the support file for the test type you are running.
  3. Register the task: in the applicable setupNodeEvents callback, call require('@cypress/code-coverage/task')(on, config).
  4. Return the config: return config from setupNodeEvents, including any changes your configuration makes.

A CommonJS-shaped Cypress configuration illustrates the task registration pattern:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      require('@cypress/code-coverage/task')(on, config)
      return config
    },
  },
})

Adapt the module syntax and event configuration to your project’s Cypress config. The package’s v4 migration notes describe configuration changes for Cypress v15.10 and later: Cypress.env() was deprecated in v15.10 and is slated for removal in Cypress 16, with configuration moving from env to expose in the package’s example. Do not copy older env.codeCoverage examples without checking the version of Cypress and the collector installed in your project.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure E2E and component tests separately

E2E and component tests can run through different support files and build paths. An import in the E2E support file does not collect coverage from component tests.

E2E tests

Import the collector from the E2E support file, register its task in the E2E setupNodeEvents, and make sure the server started for the test run serves instrumented application code.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Component tests

Import the collector from the component support file as well. Configure the task in the relevant Cypress Node setup. For Vite, the Vite Istanbul plugin can instrument the component dev server; for Webpack, add Istanbul to the component-test transpilation or bundling rules. Confirm that component runs produce coverage data independently of E2E runs.

Unit-test specs

If you also want coverage for unit-test spec files, instrument those files and configure the shared Babel setup accordingly. This is an additional configuration path, not an automatic consequence of collecting application coverage with Cypress.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Add backend coverage only with an explicit collection path

Browser coverage counters do not measure server-side application code. For a Node backend, run the server under NYC, expose its coverage object through framework middleware or a coverage endpoint, and configure the collector to fetch that endpoint. The Cypress guide describes Express and Hapi middleware patterns; another framework can expose a GET /__coverage__ route. The collector can then merge backend counters with the frontend report.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
  • Start the backend with instrumentation enabled for the source in scope.
  • Make its coverage object available to the test process through a protected, test-only endpoint or suitable middleware.
  • Configure the collector’s backend endpoint option to retrieve that object.
  • Verify that backend source files appear in the merged report and that the endpoint is not unintentionally exposed in production.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Generate and inspect a coverage report

The collector stores raw coverage data under .nyc_output. Generate a terminal summary with:

npx nyc report --reporter=text-summary

To inspect an HTML report, generate the HTML reporter and open coverage/index.html. NYC supports other reporters if your team needs formats for CI or a hosted reporting workflow. Preserve the generated coverage directory as a CI build artifact when reviewers need to inspect reports after a run.

Read the report by asking which uncovered code matters, not just how much remains. An uncovered conditional may represent a meaningful alternate outcome; an uncovered statement may be dead code or a low-risk path. Add tests that assert the expected result, especially around business rules, conditional branches, and error handling. A real-world 100% result can require multiple tests, and it is not a universal target for every project.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Keep source-code coverage distinct from UI Coverage

Source-code coverage tracks instrumented lines, functions, statements, and branches. Cypress Cloud’s UI Coverage measures which interactive interface elements tests exercised using Test Replay; it is a different measurement and does not replace source instrumentation.

The documented UI Coverage setup requires a recorded Cloud run, Test Replay enabled, Cypress v13 or later, and UI Coverage enabled for the organization. Its setup page describes the feature as not included in standard Cloud plans and offers a trial; availability and plan terms can change. UI Coverage policies—including fixed thresholds or comparison against a baseline/new-gap model—are separate from source-code coverage thresholds. The documented workflow uses the results API to retrieve results into a CI job and apply a policy.

Troubleshoot missing or misleading coverage

  • No report or no raw data: confirm the support import ran, the coverage task is registered, and setupNodeEvents returns its config. Run a test that loads instrumented application code before checking the output directory.
  • Report exists but shows no application files: verify that the test server is serving instrumented output, the instrumentation include patterns match the source, and source maps resolve to the intended files.
  • E2E coverage works but component coverage is absent: add the support import to the component support file and check the component dev server’s instrumentation configuration.
  • Repeated or distorted counters: check whether multiple build tools instrument the same files, particularly if Babel/Istanbul is enabled for both Cypress and Jest. Scope instrumentation to the intended test environment.
  • Backend files are missing: browser instrumentation alone cannot collect them. Instrument the server and verify that the configured endpoint returns its coverage object to the collector.
  • Unexpected Cypress configuration behavior: check the installed Cypress and @cypress/code-coverage versions and follow the current package migration guidance, especially for v15.10-era configuration changes.

Or skip the browser setup

ScreenshotNeo is a separate website screenshot API and MCP server, not a Cypress code-coverage collector. If your workflow also needs screenshots, a single GET request can capture a URL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for options. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed; an MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for free and get 1,000 screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Does Cypress calculate code coverage without instrumentation?

No. The application build or transpilation process must add coverage counters before the collector can report execution.

Does 100% code coverage prove that my tests are effective?

No. It indicates that the instrumented code ran, not that assertions check the right outcomes or would catch regressions.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.