Skip to content

Commit

Permalink
repro: 'set' on proxy: trap returned falsish for property with Vue v3…
Browse files Browse the repository at this point in the history
….2.45

This comes from the fact that mocks are set via a mixin (Options API) and we run into the more strict behavior of Vue v3.2.45
introduced in vuejs/core@f73925d#diff-ea4d1ddabb7e22e17e80ada458eef70679af4005df2a1a6b73418fec897603ceR404
  • Loading branch information
cexbrayat committed Nov 14, 2022
1 parent 59331e9 commit 5b24de6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/expose.spec.ts
@@ -1,4 +1,4 @@
import { describe, expect, it } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import { nextTick } from 'vue'
import { mount } from '../src'
import Hello from './components/Hello.vue'
Expand Down Expand Up @@ -61,4 +61,21 @@ describe('expose', () => {
await nextTick()
expect(wrapper.html()).toContain('2')
})

it('should not throw when mocking', async () => {
const spiedIncrement = vi.fn()
const wrapper = mount(ScriptSetup, {
global: {
mocks: {
inc: spiedIncrement
}
}
})

await wrapper.find('button').trigger('click')
await nextTick()

expect(spiedIncrement).toHaveBeenCalled()
expect(wrapper.html()).toContain('0')
})
})

0 comments on commit 5b24de6

Please sign in to comment.