Socket
Socket
Sign inDemoInstall

jest-vue-preprocessor

Package Overview
Dependencies
24
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-vue-preprocessor

Preprocessor that allows importing of .vue files in jest tests


Version published
Weekly downloads
10K
increased by7.01%
Maintainers
1
Install size
2.43 MB
Created
Weekly downloads
 

Changelog

Source

1.7.1 (2020-02-09)

Bug Fixes

  • package: update vue-property-decorator to version 8.3.0 (15aa2ba)
  • transform uses placeholderPattern: false (#163) (e73fb5b)

Readme

Source

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

Keywords

FAQs

Last updated on 09 Feb 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc