Use this folder to exercise Playwright’s Chromium page.coverage flow alongside Currents code coverage. The app is served as static files; tests assume http://localhost:5173.
- Node.js and npm
- A Currents project with record key and project ID (only if you are sending results to Currents)
npm install- In one terminal:
npm run dev(serves the app on port 5173) - In another:
npm test(playwright test --project=chromium)
On success, the spec writes raw V8 payloads under coverage/raw/ (e.g. js.json, css.json; invalid-path cases may emit *-invalid.json). Checked-in files in that directory are sample output, not a required step.
Note: playwright.config.ts is Chromium-only on purpose (page.coverage is not available on Firefox/WebKit).
This example ships with plain Playwright. To report to Currents, mirror the setup in ../instrumented-coverage/:
- Add
@currents/playwright(anddotenvif you load env from a file). - Set
CURRENTS_RECORD_KEYandCURRENTS_PROJECT_IDin the environment (or.envfor local runs). - Extend
defineConfigwithCurrentsFixtures/CurrentsWorkerFixtures, registercurrentsReporter(...), and passcurrentsConfigOptionsincludingcoverage(e.g.coverage: { projects: true }as in the instrumented example). - Set
use.baseURLtohttp://localhost:5173so it matchesnpm run dev.
For CLI/orchestrated runs, use the same pwc / pwc-p patterns described in the instrumented example README and the Playwright + Currents docs.
- Export
CURRENTS_RECORD_KEYandCURRENTS_PROJECT_IDas protected variables or secrets. - Start the static server before tests (same as local two-terminal flow), or add a
webServerblock inplaywright.config.tsthat runsnpm run devand waits on port 5173 so a singleplaywright test(orpwc) command is enough.
- Code coverage guide
- Sibling example with Currents already wired:
playwright/code-coverage/instrumented-coverage
MIT License