Skip to content

Add rollup-plugin-istanbul to the README #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,26 @@
[![npm](https://img.shields.io/npm/dw/playwright-test-coverage)](https://npmtrends.com/playwright-test-coverage)
[![Awesome](https://awesome.re/badge.svg)](https://github.com./mxschmitt/awesome-playwright)

A [Playwright](https://playwright.dev) extension that collects code coverage from running end-to-end tests. Assumes that code has been instrumented with [babel-plugin-istanbul](https://github.com./istanbuljs/babel-plugin-istanbul) during the build process.
A [Playwright](https://playwright.dev) extension that collects code coverage from running end-to-end tests. Assumes that code has been instrumented with [istanbul-lib-instrument](https://www.npmjs.com/package/istanbul-lib-instrument) during the build process, for example, with [babel-plugin-istanbul](https://github.com./istanbuljs/babel-plugin-istanbul) or [rollup-plugin-istanbul](https://github.com./artberri/rollup-plugin-istanbul).

## Prerequisites

- Playwright test framework
- `babel-plugin-istanbul` plugin
- `nyc` for running tests
- A process to instrument your JavaScript code (if you are using babel, `babel-plugin-istanbul` or if you are using `rollup`, `rollup-plugin-istanbul`)
- `nyc` for running tests or for manually generating the reports

#### If you are using babel

```bash
npm i -D @playwright/test babel-plugin-istanbul nyc
```

#### If you are using rollup

```bash
npm i -D @playwright/test rollup-plugin-istanbul nyc
```

## Installation

```bash
Expand All @@ -40,9 +48,9 @@ test("basic test", async ({ page }) => {
});
```

Then, instrument your front end source code for coverage using the `babel-plugin-istanbul` plugin.
Then, instrument your front end source code for coverage using the `babel-plugin-istanbul` or the `rollup-plugin-istanbul`.

Finally, run your server via `nyc` to capture code coverage. For more details see [istanbul/nyc](https://github.com./istanbuljs/nyc).
Finally, run your server via `nyc` to capture code coverage or manually run `nyc` with the `report` option. For more details see [istanbul/nyc](https://github.com./istanbuljs/nyc).

### Options

Expand Down