Testing Service Worker
There are quite a few test libraries, vite-plugin-pwa
uses Vitest for build testing and Playwright for in-browser testing (with the Chromium browser only).
You can check any framework example in the examples
folder in the corresponding repo:
- vite-plugin-pwa
- @vite-pwa/nuxt (in root folder)
- @vite-pwa/sveltekit
and the corresponding contributing guide:
vite-plugin-pwa
and @vite-pwa/nuxt
have been added to the Vite ecosystem-ci and Nuxt ecosystem-ci respectively to detect possible regressions in new Vite/Nuxt versions:
We're also working to include @vite-pwa/sveltekit
in the Svelte ecosystem-ci.
Testing build
Check vitest.config.mts
in the root folder and the test
folder in each example.
You have a test
script in each example package.json
file to run build and in-browser tests.
Testing in-browser
Check playwright.config.ts
in the root folder and the client-test
folder in each example.
You have a test
script in each example package.json
file to run build and in-browser tests.
In this case, we also need to start a server to run the tests, check webServer
in playwright.config.ts
.