mxschmitt / playwright-test-coverage

Playwright Test (@playwright/test) demo to collect coverage information via Istanbul
MIT License
118 stars 16 forks source link

Make this part of Playwright test runner via option? #1

Closed anishkny closed 3 years ago

anishkny commented 3 years ago

@mxschmitt thanks! Was looking for exactly this for my project.

It feels like this should be part of Playwright test runner usable via an option.

Alternately, this could be made into a npm package for consumption, instead of having to copy-paste from baseFixtures.ts. (I plan to do this for now).

anishkny commented 3 years ago

For now I have published playwright-test-coverage to npm which can be used in a Playwright test instead of copy-pasting from this repo.

const { test, expect } = require("playwright-test-coverage");  // instead of require("@playwright/test")

// Use test and expect as usual
test('basic test', async ({ page }) => {
  // Test code
});

Ideally this option will be available in Playwright directly.

mxschmitt commented 3 years ago

Yes we evaluated this, but for now we decided to keep it in the user-land since its only a few lines of code. This experiment shows us how it gets used and if it needs adjustments / parameters in the future.

anishkny commented 3 years ago

Closing out for https://github.com/microsoft/playwright/issues/7030