|
|
3 gadi atpakaļ | |
|---|---|---|
| .. | ||
| .circleci | 3 gadi atpakaļ | |
| build | 3 gadi atpakaļ | |
| lib | 3 gadi atpakaļ | |
| node_modules | 3 gadi atpakaļ | |
| test | 3 gadi atpakaļ | |
| .babelrc | 3 gadi atpakaļ | |
| .eslintignore | 3 gadi atpakaļ | |
| .eslintrc | 3 gadi atpakaļ | |
| CHANGELOG.md | 3 gadi atpakaļ | |
| LICENSE | 3 gadi atpakaļ | |
| README.md | 3 gadi atpakaļ | |
| package.json | 3 gadi atpakaļ | |
| test.sh | 3 gadi atpakaļ | |
| tsconfig.json | 3 gadi atpakaļ | |
| vue-jest.js | 3 gadi atpakaļ | |
Jest Vue transformer with source map support
npm install --save-dev vue-jest
To define vue-jest as a transformer for your .vue files, you need to map .vue files to the vue-jest module.
"transform": {
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
},
To use source maps, you need to set mapCoverage to true. A full config will look like this.
{
"jest": {
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
},
"mapCoverage": true
}
}
Example repositories testing Vue components with jest and vue-jest:
vue-jest compiles the script and template of SFCs into a JavaScript file that Jest can run. It does not currently compile the style section.
lang="ts", lang="typescript")lang="coffee", lang="coffeescript")lang="pug")lang="jade")lang="haml")