Package Exports
- vue-jest
- vue-jest/lib/process
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-jest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vue-jest
Jest Vue transformer with source map support
Usage
npm install --save-dev vue-jest
Setup
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"
},
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"
}
}
}
If you're on a version of Jest older than 22.4.0, you need to set mapCoverage
to true
in order to use source maps.
Example Projects
Example repositories testing Vue components with jest and vue-jest:
Supported langs
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.
Supported script languages
- typescript (
lang="ts"
,lang="typescript"
) - coffeescript (
lang="coffee"
,lang="coffeescript"
)
Supported template languages
- pug (
lang="pug"
) - jade (
lang="jade"
) - haml (
lang="haml"
)