Closed
Description
Version
3.0.0-rc.5
Reproduction link
https://github.com/Kusken/vue-cli-rc5-jest-vuex-issue
Steps to reproduce
Steps to reproduce
Project setup
Clone
then run
npm install
npm run test:unit
Alternatively
With @vue/cli rc5
vue create <project-name>
select:
Typescript
Vuex
Jest
After install replace /tests/HelloWorld.spec.ts
content with:
import { shallowMount } from '@vue/test-utils'
import HelloWorld from '@/components/HelloWorld.vue'
import store from "@/store";
describe('HelloWorld.vue', () => {
it('renders props.msg when passed', () => {
store.state;
})
})
Run npm run test:unit
What is expected?
Test should pass.
What is actually happening?
Test run results in this error:
TypeError: Cannot read property 'use' of undefined
2 | import Vuex from 'vuex'
3 |
> 4 | Vue.use(Vuex)
| ^
5 |
6 | export default new Vuex.Store({
7 | state: {
at Object.<anonymous> (src/store.ts:4:5)
at Object.<anonymous> (tests/unit/HelloWorld.spec.ts:3:1)
By downgrading from "ts-jest": "^23.0.0"
to "ts-jest": 22.4.6
the test passes.
P.S - ran in to the bug trying to solve another bug. To triangulate the other bug I created a new vue.js project using @vue/cli-rc5.
Metadata
Metadata
Assignees
Labels
No labels