Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

paramirez/vue-jest

Open more actions menu
 
 

Repository files navigation

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"
},

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

About

Jest Vue transformer

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 88.8%
  • Vue 8.8%
  • Shell 2.2%
  • HTML 0.2%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.