DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk3 min

How to Stop JavaScript Coverage in Puppeteer

Call await page.coverage.stopJSCoverage() after the interactions you want to measure. Learn what it returns and how to retain coverage across navigation.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Stop JavaScript coverage with await page.coverage.stopJSCoverage() after the page interactions you want to measure. It ends collection and returns an array of coverage reports. Coverage must first be started on that page.

Stop JavaScript coverage

A minimal Puppeteer flow is to start coverage, load and exercise the page, then stop coverage and retain the returned reports:

await page.coverage.startJSCoverage();
await page.goto('https://example.com');
// Perform the interactions whose JavaScript usage you want to collect.
const jsCoverage = await page.coverage.stopJSCoverage();

startJSCoverage() and stopJSCoverage() are asynchronous; await them so collection has started before navigation or interaction, and so the report is available when stopping. See the Puppeteer Coverage API.

What the stop call returns

stopJSCoverage() resolves to an array with one report entry for each reported script. Entries include script text and executed ranges, which you can inspect or pass to a coverage conversion tool. The stop call marks the end of collection; it does not reconstruct data Chrome has already discarded.

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

Collect coverage across multiple pages

The resetOnNavigation option defaults to true. Setting it to false does not guarantee that coverage survives navigation: Chrome can discard the prior page’s JavaScript execution environment and its coverage data. For a multi-page journey, stop before leaving each page, start a fresh collection on the next page, and merge the returned entries in your application.

  1. Start JavaScript coverage on the current page.
  2. Perform the interactions to measure, then call stopJSCoverage() before navigating away.
  3. Navigate to the next page and start coverage again.
  4. Combine the per-page report entries in your own reporting pipeline.

Include anonymous scripts when needed

By default, coverage omits scripts without an associated URL, including code created with eval or new Function. Start collection with reportAnonymousScripts: true to include them:

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
await page.coverage.startJSCoverage({ reportAnonymousScripts: true });

Puppeteer documents generated URLs in the form debugger://VM for these scripts unless a //# sourceURL comment provides a URL. Enable this option when anonymous code matters to your analysis; otherwise, the default avoids those entries.

Read or export the coverage data

Coverage ranges describe executed portions of each script. Puppeteer’s API example calculates used bytes by summing range.end - range.start - 1 across a script’s ranges, then compares that total with the script text length. Treat that as a range-based byte calculation, not a complete measure of runtime cost or performance.

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

For an Istanbul-consumable format, the API reference points to puppeteer-to-istanbul. JavaScript and CSS coverage are separate collections: stopping CSS coverage requires its own call, stopCSSCoverage().

Troubleshooting

  • The stop call fails or there is no report. Start JavaScript coverage on the same page first, and await the start call before attempting to stop it.
  • Coverage seems missing after navigation. Do not rely on resetOnNavigation: false to preserve execution data. Stop before navigation, restart on the next page, and merge the reports.
  • Code created with eval does not appear. Start coverage with reportAnonymousScripts: true; anonymous scripts are excluded by default.
  • You expected CSS entries in the JavaScript report. Start and stop CSS coverage separately; stopJSCoverage() returns JavaScript coverage.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a screenshot rather than a JavaScript coverage report, ScreenshotNeo returns a screenshot or PDF from one request, without setting up Puppeteer. Its endpoint is not a replacement for Puppeteer’s coverage API.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo API documentation for request options. It removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools. The free plan includes 1,000 shots per month with no card required; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.