Skip to content

createTestingPinia doesn't mock actions using vitest vi.fn #1250

Closed Answered by posva
dennybiasiolli asked this question in Help and Questions
Discussion options

You must be logged in to vote

Ah found the culprit: it's because useStore() is called outside of mounting a component context and plugins are not added in the correct order and the devtools plugin (which should not be included in test env) override actions. You can add fakeApp: true for the moment.

I'm working on a fix so this workaround isn't needed

Replies: 6 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@dennybiasiolli
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dennybiasiolli
Comment options

Answer selected by dennybiasiolli
Comment options

You must be logged in to vote
2 replies
@posva
Comment options

@dennybiasiolli
Comment options

Comment options

You must be logged in to vote
3 replies
@fredericlam
Comment options

@myan9527
Comment options

@myan9527
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #1249 on April 24, 2022 10:30.