|
|
hace 4 meses | |
|---|---|---|
| .. | ||
| .circleci | hace 4 meses | |
| build | hace 4 meses | |
| lib | hace 4 meses | |
| node_modules | hace 4 meses | |
| test | hace 4 meses | |
| .babelrc | hace 4 meses | |
| .eslintignore | hace 4 meses | |
| .eslintrc | hace 4 meses | |
| CHANGELOG.md | hace 4 meses | |
| LICENSE | hace 4 meses | |
| README.md | hace 4 meses | |
| package.json | hace 4 meses | |
| test.sh | hace 4 meses | |
| tsconfig.json | hace 4 meses | |
| vue-jest.js | hace 4 meses | |
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")