How do you get coverage set up with Playwright?
I've tried using the vitest test runner with istanbul coverage but it doesn't report coverage for playwright tests. I've also tried using the playwright test runner but can't seem to get coverage working with that at all.
Any help would be greatly appreciated. 😃
3 Replies
Hi @Existentialalex. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry, but the knowledge sources do not contain explicit instructions or examples for setting up code coverage with Playwright in the context of Nuxt or @nuxt/test-utils. The documentation covers how to use Playwright for end-to-end testing with Nuxt, both programmatically and with the Playwright test runner, but it does not mention coverage setup or reporting for Playwright tests specifically. Coverage is discussed in relation to Vitest (e.g., with @vitest/coverage-v8), but not for Playwright-driven tests.
If you need coverage for your Playwright tests, you may need to consult the Playwright documentation or community resources for up-to-date solutions, as this is not covered in the provided Nuxt documentation or related sources at this time. If you are using Vitest for unit or integration tests, coverage is supported, but this does not extend to browser-based E2E tests run with Playwright according to the current Nuxt docs and related materials provided here Testing in a Browser.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@889931446058381313> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Unfortunately that seems to be how it is. I will do without it for now and see if someone else responds to this thread.
I've spent most of the morning searching for an answer but maybe it's something that needs adding direct to the nuxt test utils.
EDIT - After doing some more digging it seems like coverage reports on E2E testing isn't really a thing unfortunately. I'll stick to unit tests to track this in this case.