# puppeteer-to-istanbul

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

Latest version **1.4.0** (published 2020-06-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install puppeteer-to-istanbul
pnpm add puppeteer-to-istanbul
yarn add puppeteer-to-istanbul
bun add puppeteer-to-istanbul
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2020-06-11 |
| First published | 2018-02-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 39.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 214 |
| Author | Hackillinois 2018, team Istanbul |
| Maintainers | bcoe, oss-bot |
| Keywords | istanbul, puppeteer, convert, coverage |

## Links

- npm: https://www.npmjs.com/package/puppeteer-to-istanbul
- Repository: https://github.com/istanbuljs/puppeteer-to-istanbul
- Homepage: https://github.com/istanbuljs/puppeteer-to-istanbul#readme
- Issues: https://github.com/istanbuljs/puppeteer-to-istanbul/issues
- npm.io page: https://npm.io/package/puppeteer-to-istanbul

## Dependencies (4)

- [clone](https://npm.io/package/clone.md) ^2.1.2
- [yargs](https://npm.io/package/yargs.md) ^15.3.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^1.0.4
- [v8-to-istanbul](https://npm.io/package/v8-to-istanbul.md) ^1.2.1

## Alternatives

- [@snazzah/davey](https://npm.io/package/@snazzah/davey.md) — 1.5M weekly downloads
- [@vendure/testing](https://npm.io/package/@vendure/testing.md) — 8.3K weekly downloads
- [vue-simple-context-menu](https://npm.io/package/vue-simple-context-menu.md) — 6.6K weekly downloads
- [cypress-webpack-preprocessor-v5](https://npm.io/package/cypress-webpack-preprocessor-v5.md) — 2.1K weekly downloads
- [@backstage/plugin-catalog-backend-module-puppetdb](https://npm.io/package/@backstage/plugin-catalog-backend-module-puppetdb.md) — 1.3K weekly downloads

## Recent versions

- 1.4.0 (latest) — 2020-06-11
- 1.3.0 (next) — 2020-04-14
- 1.3.1 — 2020-05-11
- 1.2.2 — 2018-03-03
- 1.2.1 — 2018-03-01
- 1.2.0 — 2018-02-25

## README

# Puppeteer to Istanbul

[![Build Status](https://travis-ci.org/istanbuljs/puppeteer-to-istanbul.svg?branch=master)](https://travis-ci.org/istanbuljs/puppeteer-to-istanbul)
[![Coverage Status](https://coveralls.io/repos/github/istanbuljs/puppeteer-to-istanbul/badge.svg?branch=master)](https://coveralls.io/github/istanbuljs/puppeteer-to-istanbul?branch=master)
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)

Convert coverage from the format outputted by [puppeteer](https://developers.google.com/web/tools/puppeteer/) to a format consumable by [Istanbul][istanbul].

## Usage

### To Output Coverage in Istanbul Format with Puppeteer

1. install _puppeteer_, `npm i -D puppeteer`.
2. install _puppeteer-to-istanbul_, `npm i -D puppeteer-to-istanbul`.
3. run your code in puppeteer with coverage enabled:

    ```js
    (async () => {
      const pti = require('puppeteer-to-istanbul')
      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(),
      ]);
      pti.write([...jsCoverage, ...cssCoverage], { includeHostname: true , storagePath: './.nyc_output' })
      await browser.close()
    })()
    ```

### To Check Istanbul Reports

1. install nyc, `npm i nyc -g`.
2. use nyc's report functionality:

    ```bash
    nyc report --reporter=html
    ```

_puppeteer-to-istanbul_ outputs temporary files in a format that can be
consumed by nyc.

see [istanbul](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-reports/lib) for a list of possible reporters.

## Contributing

The best way to get started with Puppeteer to Istanbul is by installing it for yourself and running tests.
PTI requires the most recent build of __v8toistanbul__ to function properly, so start by running `npm install`. 

Next, ensure that all tests are passing before continuing by running `npm test` (or equivalently, `npm t`). This should generate a report that gives the same coverage as seen on this README. 

Note that a majority of the tests run against pre-generated fixtures, or JSON snippets, that come from Puppeteer's raw output. These are located in the `\test\fixtures` area. To generate one of your own, write or use one of the scripts in the test area `test\sample_js`, and run `bin/puppeteer-js-runner.js` through node, like so: 

`node bin/puppeteer-js-runner.js --file=/test/sample_js/sample2.js`.

If you see an issue with Puppeteer to Istanbul, please open an issue! If you want to help improve Puppeteer to Istanbul, please fork the repository and open a pull request with your changes.

Make sure to review our [contributing guide][contributing] for specific guidelines on contributing.

[coveralls]: https://github.com/GoogleChrome/puppeteer
[istanbul]: https://github.com/istanbuljs/istanbuljs
[nyc]: https://github.com/istanbuljs/nyc
[contributing]: https://github.com/istanbuljs/puppeteer-to-istanbul/blob/master/CONTRIBUTING.md

---
_Source: https://npm.io/package/puppeteer-to-istanbul · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
