jest-vue-preprocessor

1.7.1 • Public • Published

jest-vue-preprocessor

Greenkeeper badge Build Status npm version codecov Commitizen friendly

A locoslab/vue-typescript-jest JavaScript port to allow Jest load .vue files in tests. This package supports both ES6 (Babel) and TypeScript.

Portions both preprocessors are heavily based vueify (Copyright (c) 2014-2016 Evan You).

Installation

  1. add package you your project
  • yarn add --dev jest-vue-preprocessor or npm install --saveDev jest-vue-preprocessor
  1. modify package.json's jest section by adding/editing moduleFileExtensions and transform properites:

    "jest": {
      "moduleFileExtensions": [
        "js",
        "vue"
      ],
      "mapCoverage": true,
      "transform": {
        "^.+\\.js$": "<rootDir>/node_modules/babel-jest",
        ".*\\.(vue)$": "<rootDir>/node_modules/jest-vue-preprocessor"
      }
    }
  2. Start writing test that can import *.vue components - see example ./tests/index.spec.js

  3. Profit!

### Customization

  • non-relative component imports - you properly set jest's moduleMapper option - see #25

### Contributing guide

### License: MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.7.13,965latest

Version History

VersionDownloads (Last 7 Days)Published
1.7.13,965
1.7.0127
1.6.01
1.5.0309
1.4.0150
1.3.196
1.3.00
1.2.011
1.1.086
1.0.10
1.0.00
0.2.0137
0.1.30
0.1.22
0.1.10
0.1.00

Package Sidebar

Install

npm i jest-vue-preprocessor

Weekly Downloads

4,884

Version

1.7.1

License

MIT

Unpacked Size

23.9 kB

Total Files

25

Last publish

Collaborators

  • vire