node package manager



Jest Vue transformer with source map support


npm install --save-dev jest-vue


To define jest-vue as a transformer for your .vue files, you need to map .vue files to the jest-vue module.

"transform": {
  ".*\\.(vue)$": "<rootDir>/node_modules/jest-vue"

To use source maps, you need to set mapCoverage to true. A full config will look like this.

  "jest": {
    "moduleFileExtensions": [
    "transform": {
      "^.+\\.js$": "<rootDir>/node_modules/babel-jest",
      ".*\\.(vue)$": "<rootDir>/node_modules/jest-vue"
    "mapCoverage": true

Example Projects

Example repositories testing Vue components with jest and jest-vue:

Supported langs

jest-vue 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")