Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c25b1aa

Browse files
authored
chore: globally .use(Vuex) when using instantiated store (#247)
1 parent 9d367e7 commit c25b1aa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎src/__tests__/vuex.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import '@testing-library/jest-dom'
22
import {render, fireEvent} from '@testing-library/vue'
3+
import Vue from 'vue'
34
import Vuex from 'vuex'
45

56
import VuexTest from './components/Store/VuexTest'
@@ -57,6 +58,12 @@ test('can render with vuex with custom store', async () => {
5758
})
5859

5960
test('can render with an instantiated Vuex store', async () => {
61+
// Before calling new Vuex.Store in your code, you'll need to `.use` it on the
62+
// global (or local) Vue instance. In frameworks like Jest, the `setupFilesAfterEnv`
63+
// property is a good place to do this.
64+
// https://jestjs.io/docs/configuration#setupfilesafterenv-array
65+
Vue.use(Vuex)
66+
6067
const {getByTestId, getByText} = render(VuexTest, {
6168
store: new Vuex.Store({
6269
state: {count: 3},

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /