This is an example of a Next.js project with Playwright code coverage enabled through the monocart-reporter.
- (Code) Set up your
playwright.config.tsfor themonocart-reporter. - (Code) Update your Webpack config to set
config.devtoolto"source-map". - (Code) Include the
beforeEachandafterEachcoverage collection in each of your test files, for client coverage. - (Code) Include
globalTeardown.jsto collect server coverage.
When debugging, you can use
./start.shto make sure you're working with a fresh environment.
bun installbun devbun test:e2eAfter bun test:e2e has finished, open /playwright/results/coverage/index.html in your browser to view the client-side coverage report.