Closed andrew-breunig closed 5 years ago
Same issue here but with SSR, not with Jest - can't get it working via babel though as mentioned.
The same issue with SSR
This should be addressed by more recent builds. Please reopen if this is still occurring.
I've run into syntax errors when running Jest tests with Vue.js, Vuex, TypeScript, and
vuex-typex
. I'm fairly new to working with Vue.js, TypeScript, and Jest.It may be useful to mention that the tests in question are written directly against a Vuex store object, not a Vue component.
Here's the error output I get:
I'm using the following versions of these tools:
"vue": "^2.5.10"
"vuex": "^3.0.0"
"typescript": "^2.6.2"
"vuex-typex": "^3.0.1"
"jest": "^21.2.1"
"jest-vue-preprocessor": "^1.3.1"
"@types/jest": "^21.1.8"
"ts-jest": "^21.2.4"
"typescript-babel-jest": "^1.0.5"
And here are the configuration settings that process test code:
.babelrc
package.json
tsconfig.json
I thought this might be some kind of compilation issue in the distribution code published to npm, so I tried manually processing the
dist/index.js
file with Babel to the targets I'm using:es2015
stage-2
"browserslist": [ "> 1%", "last 2 versions", "not ie <= 8" ]
This appeared to resolve the issue for me, but I'm only partially confident in my diagnosis. I don't see any other issues (open or closed) on this repository that would suggest others have run into this problem. I don't want to apply a misguided workaround or obscure an underlying implementation problem in my code.
I'm hoping that this is just a simple oversight or misunderstanding on my part. Can you offer any insight? Have you, or others you know, used this particular set of tools together with Jest tests? It appears that the tests for
vuex-typex
were written with Mocha and Chai, but I imagine that others must be using this with Jest, too.