-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[@vite-pwa/nuxt] TypeError: window.matchMedia is not a function #67
Comments
@szulcus you can wrap with |
@userquin thanks for your fast response. I wrap this component with With module and client component: Without module and with client component: I don't use |
@szulcus yeah, you're in test mode and so we need a // components/TestAware.client.ts
import { defineComponent } from 'vue'
export default defineComponent({
async setup(_props, { slots }) {
if (import.meta.env.MODE === 'test') {
return () => null
}
return () => {
return slots.default && slots.default({})
}
},
}) Then wrap your SFC using the |
Uhmm, so the problem seems to be the auto registration, but if not used why is it failing (check the stack trace)? You can use the virtual ( |
I use Nuxt 3 with Vitest (nuxt-vitest module) and when I run tests, I have this error repeatedmany times:
Workaround
When I disable this module and remove
VitePwaManifest
component fromapp.vue
, tests works fine.~/app.vue
~/nuxt.config.ts
The text was updated successfully, but these errors were encountered: