npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

puppeteer-to-istanbul-extra

v0.0.2

Published

convert from puppeteer's coverage output to a format that can be used by istanbul reports

Downloads

1

Readme

Puppeteer to Istanbul Extra

Convert coverage from the format outputted by puppeteer to a format consumable by [Istanbul][istanbul].

Introduction

Puppeteer-to-istanbul-extra is a fork of puppeteer-to-istanbul. It is basically the same as, but provides additional functionality.

Usage

To Output Coverage in Istanbul Format with Puppeteer

  1. install puppeteer, npm i -D puppeteer.

  2. install puppeteer-to-istanbul-extra, npm i -D puppeteer-to-istanbul-extra.

  3. run your code in puppeteer with coverage enabled:

    (async () => {
      const pti = require('puppeteer-to-istanbul-extra')
      const puppeteer = require('puppeteer')
      const browser = await puppeteer.launch()
      const page = await browser.newPage()
    
      // Enable both JavaScript and CSS coverage
      await Promise.all([
        page.coverage.startJSCoverage(),
        page.coverage.startCSSCoverage()
      ]);
      // Navigate to page
      await page.goto('https://www.google.com');
      // Disable both JavaScript and CSS coverage
      const [jsCoverage, cssCoverage] = await Promise.all([
        page.coverage.stopJSCoverage(),
        page.coverage.stopCSSCoverage(),
      ]);
      const options_obj = {output_dir: './.nyc_output'}
      pti.write([...jsCoverage, ...cssCoverage], options_obj)
      await browser.close()
    })()

Options

Puppeteer-to-istanbul-extra provides options for use with the write method.

Here are the available options:

| Option name | Description | Type | Default | | ----------- | ----------- | ---- | ------- | | output_dir | Directory to output coverage information | String | ./.nyc_output | | backup | Define backup characteristics for coverage files. If true, will backup existing files. | Boolean | false |

To Check Istanbul Reports

  1. install nyc, npm i nyc -g.

  2. use nyc's report functionality:

    nyc report --reporter=html

puppeteer-to-istanbul-extra outputs temporary files in a format that can be consumed by nyc.

see istanbul for a list of possible reporters.

Extras

Please see Puppeteer-to-Istanbul for additional information.