We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.0.0-rc.5
https://github.com/Kusken/vue-cli-rc5-jest-vuex-issue
then run
npm install npm run test:unit
With @vue/cli rc5
vue create <project-name>
select:
Typescript Vuex Jest
After install replace /tests/HelloWorld.spec.ts content with:
/tests/HelloWorld.spec.ts
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
npm run test:unit
Test should pass.
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.
"ts-jest": "^23.0.0"
"ts-jest": 22.4.6
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.
The text was updated successfully, but these errors were encountered:
I had the same problem the other day, I fixed it by updating my tsconfig.json with:
tsconfig.json
{ "compilerOptions": { "esModuleInterop": true } }
It makes tests work and doesn't break the app.
Sorry, something went wrong.
a352bdc
import * as Vuex from 'vuex' If anyone still experiencing similar issue with typescript
import * as Vuex from 'vuex'
No branches or pull requests
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
Alternatively
With @vue/cli rc5
select:
After install replace
/tests/HelloWorld.spec.ts
content with:Run
npm run test:unit
What is expected?
Test should pass.
What is actually happening?
Test run results in this error:
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.
The text was updated successfully, but these errors were encountered: