vue-jest-kn

2.0.2 • Public • Published

vue-jest-kn

Jest Vue transformer with source map support
custom tsconfig support - temporary npm, please avoid usage as it will be deleted sooner than later

Usage

npm install --save-dev vue-jest-kn

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

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

Package Sidebar

Install

npm i vue-jest-kn

Weekly Downloads

2

Version

2.0.2

License

MIT

Unpacked Size

27.4 kB

Total Files

22

Last publish

Collaborators

  • knlarseggert