chore(tests): fix vitest can't terminate worker (#2644)

zio/stable
Joaquín Sánchez 2024-03-04 17:41:38 +01:00 committed by GitHub
parent edfbe2c3ed
commit 0fa87f71a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 1 deletions

View File

@ -21,7 +21,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 18 node-version: 20
cache: pnpm cache: pnpm
- name: 📦 Install dependencies - name: 📦 Install dependencies

View File

@ -211,6 +211,30 @@ vi.mock('vue-router', async () => {
} }
}) })
vi.mock('@vueuse/shared', async () => {
const vueuseShared = await import('@vueuse/shared')
// mock pausableWatch and watchPausable: vitest process hangs from time to time
return {
...vueuseShared,
pausableWatch: () => {
return {
stop: () => {},
pause: () => {},
resume: () => {},
isActive: readonly(ref(true)),
}
},
watchPausable: () => {
return {
stop: () => {},
pause: () => {},
resume: () => {},
isActive: readonly(ref(true)),
}
},
}
})
mockComponent('ContentMentionGroup', { mockComponent('ContentMentionGroup', {
setup(props, { slots }) { setup(props, { slots }) {
return () => h('mention-group', null, { default: () => slots?.default?.() }) return () => h('mention-group', null, { default: () => slots?.default?.() })

View File

@ -10,5 +10,13 @@ export default defineVitestConfig({
setupFiles: [ setupFiles: [
'/tests/setup.ts', '/tests/setup.ts',
], ],
environmentOptions: {
nuxt: {
mock: {
indexedDb: true,
intersectionObserver: true,
},
},
},
}, },
}) })