├── .github
├── publish.yml
└── release-please.yml
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── CONTIRUBTORS.md
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── bin
├── .gitkeep
└── puppeteer-js-runner.js
├── index.js
├── lib
├── .gitkeep
├── output-files.js
├── puppeteer-to-istanbul.js
└── puppeteer-to-v8.js
├── package.json
└── test
├── fixtures
├── block-else-not-covered.json
├── block-logical-not-covered.json
├── function-coverage-full-duplicate.json
├── function-coverage-missing.json
├── http-es6-modules.json
├── inline-and-external-script-coverage.json
├── inline-script-coverage.json
├── merge-coverage
│ ├── non-inline-script-a.json
│ └── non-inline-script-b.json
└── two-inline.json
├── output-files.js
├── puppeteer-to-istanbul.js
├── puppeteer-to-v8.js
└── sample_js
├── block-else-not-covered.js
├── block-logical-not-covered.js
├── function-coverage-100.js
├── function-coverage-missing.js
├── function-no-coverage.js
├── inline.js
└── two-inline.js
/.github/publish.yml:
--------------------------------------------------------------------------------
1 | project: oss-automation
2 | secretId: node-tooling
3 |
--------------------------------------------------------------------------------
/.github/release-please.yml:
--------------------------------------------------------------------------------
1 | releaseType: node
2 | handleGHRelease: true
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | package-lock.json
4 | .nyc_output
5 | coverage
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "8"
4 | - "node"
5 | after_success:
6 | - c8 report --reporter=text-lcov | coveralls
7 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 |
6 | ## [1.4.0](https://www.github.com/istanbuljs/puppeteer-to-istanbul/compare/v1.3.1...v1.4.0) (2020-06-11)
7 |
8 |
9 | ### Features
10 |
11 | * allow a custom storagePath ([#56](https://www.github.com/istanbuljs/puppeteer-to-istanbul/issues/56)) ([eb1aabc](https://www.github.com/istanbuljs/puppeteer-to-istanbul/commit/eb1aabc705ed10bfc5010128eb0fbaf69c17f777))
12 | * allow the output file to not include the hostname ([#57](https://www.github.com/istanbuljs/puppeteer-to-istanbul/issues/57)) ([3a5b312](https://www.github.com/istanbuljs/puppeteer-to-istanbul/commit/3a5b312c0b02a9a2115a54ddd5095b3684257e78))
13 |
14 | ### [1.3.1](https://www.github.com/istanbuljs/puppeteer-to-istanbul/compare/v1.3.0...v1.3.1) (2020-05-11)
15 |
16 |
17 | ### Bug Fixes
18 |
19 | * JSON encode URL ([8aa1c44](https://www.github.com/istanbuljs/puppeteer-to-istanbul/commit/8aa1c448252da995e7507272878eb00f44242215))
20 |
21 | ## [1.3.0](https://www.github.com/istanbuljs/puppeteer-to-istanbul/compare/v1.2.2...v1.3.0) (2020-04-14)
22 |
23 |
24 | ### Features
25 |
26 | * add support for complete path reporting on files with http(s) protocol ([#17](https://www.github.com/istanbuljs/puppeteer-to-istanbul/issues/17)) ([149716b](https://www.github.com/istanbuljs/puppeteer-to-istanbul/commit/149716b5323b7b1025e43c17e577744601528f72))
27 | * include original url in final output. ([#34](https://www.github.com/istanbuljs/puppeteer-to-istanbul/issues/34)) ([dec48a2](https://www.github.com/istanbuljs/puppeteer-to-istanbul/commit/dec48a25d0e2145ad44a485d591b1b58d1039091))
28 |
29 |
30 | ### Bug Fixes
31 |
32 | * do not overwrite coverage after each test suite ([#42](https://www.github.com/istanbuljs/puppeteer-to-istanbul/issues/42)) ([848aa76](https://www.github.com/istanbuljs/puppeteer-to-istanbul/commit/848aa76533ce63f09a319d377b84163151505a5e))
33 | * JSON being output was not valid ([de9109c](https://www.github.com/istanbuljs/puppeteer-to-istanbul/commit/de9109c794523eb8924ef24770503908650cc952))
34 | * write to disk incrementally ([#40](https://www.github.com/istanbuljs/puppeteer-to-istanbul/issues/40)) ([c57bd74](https://www.github.com/istanbuljs/puppeteer-to-istanbul/commit/c57bd741534813a7b42c8f300ddb61ef42086ef1))
35 |
36 | ## [1.2.2](https://github.com/istanbuljs/puppeteer-to-istanbul/compare/v1.2.1...v1.2.2) (2018-03-03)
37 |
38 |
39 | ### Bug Fixes
40 |
41 | * we need to create the .nyc_output folder if it doesn't exist ([17c9e69](https://github.com/istanbuljs/puppeteer-to-istanbul/commit/17c9e69))
42 |
43 |
44 |
45 |
46 | ## [1.2.1](https://github.com/istanbuljs/puppeteer-to-istanbul/compare/v1.2.0...v1.2.1) (2018-03-01)
47 |
48 |
49 | ### Bug Fixes
50 |
51 | * clone should be a regular dependency not a dev dependency ([9dad7fc](https://github.com/istanbuljs/puppeteer-to-istanbul/commit/9dad7fc))
52 |
53 |
54 |
55 |
56 | # [1.2.0](https://github.com/istanbuljs/puppeteer-to-istanbul/compare/v1.1.0...v1.2.0) (2018-02-25)
57 |
58 |
59 | ### Bug Fixes
60 |
61 | * file:// was missing ([0ec1a0a](https://github.com/istanbuljs/puppeteer-to-istanbul/commit/0ec1a0a))
62 | * output format didn't quite match v8 ([#5](https://github.com/istanbuljs/puppeteer-to-istanbul/issues/5)) ([8b669f8](https://github.com/istanbuljs/puppeteer-to-istanbul/commit/8b669f8))
63 |
64 |
65 | ### Features
66 |
67 | * add entry-point document ([#10](https://github.com/istanbuljs/puppeteer-to-istanbul/issues/10)) ([1f49ae5](https://github.com/istanbuljs/puppeteer-to-istanbul/commit/1f49ae5))
68 | * Implemented JS local copying and renaming for conversion to v8 ([#6](https://github.com/istanbuljs/puppeteer-to-istanbul/issues/6)) ([be72192](https://github.com/istanbuljs/puppeteer-to-istanbul/commit/be72192))
69 | * implemented puppeteer to V8 class ([#4](https://github.com/istanbuljs/puppeteer-to-istanbul/issues/4)) ([327c1ef](https://github.com/istanbuljs/puppeteer-to-istanbul/commit/327c1ef))
70 |
71 |
72 |
73 |
74 | # 1.1.0 (2018-02-24)
75 |
76 |
77 | ### Features
78 |
79 | * add command-line-tool for outputting coverage in puppeteer format ([#1](https://github.com/istanbuljs/puppeteer-to-istanbul/issues/1)) ([111354d](https://github.com/istanbuljs/puppeteer-to-istanbul/commit/111354d))
80 | * initial library structure ([6b2deb5](https://github.com/istanbuljs/puppeteer-to-istanbul/commit/6b2deb5))
81 |
--------------------------------------------------------------------------------
/CONTIRUBTORS.md:
--------------------------------------------------------------------------------
1 | # Contributors
2 |
3 | - [Benjamin E. Coe](https://github.com/bcoe) (ben@npmjs.com)
4 |
5 | Mentor and Project Lead
6 | - [Viktor Köves](https://github.com/vkoves/) (vkoves@hawk.iit.edu)
7 |
8 | Handled logic for converting from Puppeteer to V8 coverage format
9 | - [Robert Altman](https://github.com/rjaltman) (rjaltman04@gmail.com)
10 |
11 | Worked on handling file storage for Puppeteer to Istanbul
12 | - [Ashwin Gokhale](https://github.com/ashwinGokhale) (gokhale0@purdue.edu)
13 |
14 | Worked on a system to show coverage on the splash page
15 | - [Mustafa Musabeyli](https://github.com/musabeyli/) (musabeyli@wisc.edu)
16 |
17 | Styled and created the splash page
18 | - [Tony An](https://github.com/computerguy708/) (tan1@hawk.iit.edu)
19 |
20 | Wrote copy for the splash page
21 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | When contributing to this repository, please first discuss the change you wish to make via issue,
4 | email, or any other method with the owners of this repository before making a change.
5 |
6 | Please note we have a code of conduct, please follow it in all your interactions with the project.
7 |
8 | ## Pull Request Process
9 |
10 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11 | build.
12 | 2. Update the README.md with details of changes to the interface, this includes new environment
13 | variables, exposed ports, useful file locations and container parameters.
14 | 3. Increase the version numbers in any examples files and the README.md to the new version that this
15 | Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
16 | 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
17 | do not have permission to do that, you may request the second reviewer to merge it for you.
18 |
19 | ## Code of Conduct
20 |
21 | ### Our Pledge
22 |
23 | In the interest of fostering an open and welcoming environment, we as
24 | contributors and maintainers pledge to making participation in our project and
25 | our community a harassment-free experience for everyone, regardless of age, body
26 | size, disability, ethnicity, gender identity and expression, level of experience,
27 | nationality, personal appearance, race, religion, or sexual identity and
28 | orientation.
29 |
30 | ### Our Standards
31 |
32 | Examples of behavior that contributes to creating a positive environment
33 | include:
34 |
35 | * Using welcoming and inclusive language
36 | * Being respectful of differing viewpoints and experiences
37 | * Gracefully accepting constructive criticism
38 | * Focusing on what is best for the community
39 | * Showing empathy towards other community members
40 |
41 | Examples of unacceptable behavior by participants include:
42 |
43 | * The use of sexualized language or imagery and unwelcome sexual attention or
44 | advances
45 | * Trolling, insulting/derogatory comments, and personal or political attacks
46 | * Public or private harassment
47 | * Publishing others' private information, such as a physical or electronic
48 | address, without explicit permission
49 | * Other conduct which could reasonably be considered inappropriate in a
50 | professional setting
51 |
52 | ### Our Responsibilities
53 |
54 | Project maintainers are responsible for clarifying the standards of acceptable
55 | behavior and are expected to take appropriate and fair corrective action in
56 | response to any instances of unacceptable behavior.
57 |
58 | Project maintainers have the right and responsibility to remove, edit, or
59 | reject comments, commits, code, wiki edits, issues, and other contributions
60 | that are not aligned to this Code of Conduct, or to ban temporarily or
61 | permanently any contributor for other behaviors that they deem inappropriate,
62 | threatening, offensive, or harmful.
63 |
64 | ### Scope
65 |
66 | This Code of Conduct applies both within project spaces and in public spaces
67 | when an individual is representing the project or its community. Examples of
68 | representing a project or community include using an official project e-mail
69 | address, posting via an official social media account, or acting as an appointed
70 | representative at an online or offline event. Representation of a project may be
71 | further defined and clarified by project maintainers.
72 |
73 | ### Enforcement
74 |
75 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
76 | reported by contacting the project team. All
77 | complaints will be reviewed and investigated and will result in a response that
78 | is deemed necessary and appropriate to the circumstances. The project team is
79 | obligated to maintain confidentiality with regard to the reporter of an incident.
80 | Further details of specific enforcement policies may be posted separately.
81 |
82 | Project maintainers who do not follow or enforce the Code of Conduct in good
83 | faith may face temporary or permanent repercussions as determined by other
84 | members of the project's leadership.
85 |
86 | ### Attribution
87 |
88 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
89 | available at [http://contributor-covenant.org/version/1/4][version]
90 |
91 | [homepage]: http://contributor-covenant.org
92 | [version]: http://contributor-covenant.org/version/1/4/
93 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | ISC License
2 |
3 | Copyright (c) 2018, Contributors
4 |
5 | Permission to use, copy, modify, and/or distribute this software
6 | for any purpose with or without fee is hereby granted, provided
7 | that the above copyright notice and this permission notice
8 | appear in all copies.
9 |
10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
12 | OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
13 | LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
14 | OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
15 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
16 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Puppeteer to Istanbul
2 |
3 | [](https://travis-ci.org/istanbuljs/puppeteer-to-istanbul)
4 | [](https://coveralls.io/github/istanbuljs/puppeteer-to-istanbul?branch=master)
5 | [](https://github.com/conventional-changelog/standard-version)
6 |
7 | Convert coverage from the format outputted by [puppeteer](https://developers.google.com/web/tools/puppeteer/) to a format consumable by [Istanbul][istanbul].
8 |
9 | ## Usage
10 |
11 | ### To Output Coverage in Istanbul Format with Puppeteer
12 |
13 | 1. install _puppeteer_, `npm i -D puppeteer`.
14 | 2. install _puppeteer-to-istanbul_, `npm i -D puppeteer-to-istanbul`.
15 | 3. run your code in puppeteer with coverage enabled:
16 |
17 | ```js
18 | (async () => {
19 | const pti = require('puppeteer-to-istanbul')
20 | const puppeteer = require('puppeteer')
21 | const browser = await puppeteer.launch()
22 | const page = await browser.newPage()
23 |
24 | // Enable both JavaScript and CSS coverage
25 | await Promise.all([
26 | page.coverage.startJSCoverage(),
27 | page.coverage.startCSSCoverage()
28 | ]);
29 | // Navigate to page
30 | await page.goto('https://www.google.com');
31 | // Disable both JavaScript and CSS coverage
32 | const [jsCoverage, cssCoverage] = await Promise.all([
33 | page.coverage.stopJSCoverage(),
34 | page.coverage.stopCSSCoverage(),
35 | ]);
36 | pti.write([...jsCoverage, ...cssCoverage], { includeHostname: true , storagePath: './.nyc_output' })
37 | await browser.close()
38 | })()
39 | ```
40 |
41 | ### To Check Istanbul Reports
42 |
43 | 1. install nyc, `npm i nyc -g`.
44 | 2. use nyc's report functionality:
45 |
46 | ```bash
47 | nyc report --reporter=html
48 | ```
49 |
50 | _puppeteer-to-istanbul_ outputs temporary files in a format that can be
51 | consumed by nyc.
52 |
53 | see [istanbul](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-reports/lib) for a list of possible reporters.
54 |
55 | ## Contributing
56 |
57 | The best way to get started with Puppeteer to Istanbul is by installing it for yourself and running tests.
58 | PTI requires the most recent build of __v8toistanbul__ to function properly, so start by running `npm install`.
59 |
60 | 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.
61 |
62 | 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:
63 |
64 | `node bin/puppeteer-js-runner.js --file=/test/sample_js/sample2.js`.
65 |
66 | 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.
67 |
68 | Make sure to review our [contributing guide][contributing] for specific guidelines on contributing.
69 |
70 | [coveralls]: https://github.com/GoogleChrome/puppeteer
71 | [istanbul]: https://github.com/istanbuljs/istanbuljs
72 | [nyc]: https://github.com/istanbuljs/nyc
73 | [contributing]: https://github.com/istanbuljs/puppeteer-to-istanbul/blob/master/CONTRIBUTING.md
74 |
--------------------------------------------------------------------------------
/bin/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/istanbuljs/puppeteer-to-istanbul/5947d2dcd8923cbade75aefab23150bab02cfa61/bin/.gitkeep
--------------------------------------------------------------------------------
/bin/puppeteer-js-runner.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | const fs = require('fs')
4 | const path = require('path')
5 | const puppeteer = require('puppeteer')
6 | require('yargs') // eslint-disable-line
7 | .usage('$0