Comments (9)
rn you cannot test service workers in Vitest, and @vitest/browser
still experimental...
from docs.
The latest Vitest version (0.33) doesn't have an issue anymore. Not sure what change they made, but this is not an issue anymore
from docs.
can you try adding v-if="!import.meta.vitest"
to the component?
<BaseReloadPrompt v-if="!import.meta.vitest"....
from docs.
I am not testing them in vitest, rather it just gets imported automatically across all tests, as it's a base component. But I'll give it a go with v-if
as I am not testing it
from docs.
ok, you can check examples/vue-router
in vite-plugin-pwa
, I'll test it with latest Vitest... you have a build and browser tests with Vitest and PlayWright respectivelly.
from docs.
Yeah, I can't just do v-if
and I am not interested in browser tests. I think I need to just adjust my auto-imports to ignore this component in vitest environment
Edit: It's actually not the auto-loading plugin I made. I am not importing this component at all now and I am still getting an error.
from docs.
Maybe you can use defineAsyncComponent
doing the check inside the resolver returning undefined, avoid registering the component globally (auto-import or similar libs).
I have all tests working on my local (vite-plugin-pwa
), I haven't sent the PR yet to bump dependencies...
from docs.
I guess you're testing your app with @vue/test-utils
, maybe you can create a functional ts/js component, rendering the component inside the setup, something like this:
// src/components/base_components/BaseWrapperReloadPrompt.ts
import { defineComponent, h } from 'vue'
export const BaseWrapperReloadPrompt = defineComponent({
async setup(props) {
if (import.meta.vitest)
return {}
const component = await import('./BaseReloadPrompt.vue')
return () => h(component.default ?? component, props)
},
})
from docs.
thx for reporting @doutatsu
from docs.
Related Issues (20)
- automatic cutting
- Typo HOT 6
- Doc around caching strategy is confusing. HOT 4
- How to set ignoreVary for matching cache in ? HOT 2
- self.skipWaiting is not a function HOT 6
- `devTools.enabled` in strategy `generateSW` breaks due to wrong `globDirectory` HOT 1
- No workbox debug logs in with `devtools.enabled` and strategy `injectedManifest` HOT 1
- Where to put the manifest generated data? HOT 4
- [BUG]: custom envPrefix doesn't work when building
- Cleaning local storage on automatic reload
- Add an example to implement Push Notifications? HOT 6
- Is it possible to change the index.html file name?
- Warnings on setting up a new workspace HOT 1
- Server keeps reloading in dev-mode on GET requests
- Create manifest.webmanifest in a sub directory of public HOT 3
- Ability to track download progress?
- Service Worker "import sentry-release-injection" error when loading page
- If I want to create a big data screen, how do I know the website where I installed it?
- "@vite-pwa/nuxt": "^0.1.1" - manifest.webmanifest is 404 HOT 1
- Generate PWA icons using favicon.inbrowser.app HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docs.