A Jest preprocessor to load .vue files in tests.
- add package you your project
-
yarn add --dev vue-preprocessor
ornpm install --saveDev vue-preprocessor
-
modify your jest config transform properties:
"jest": { "moduleFileExtensions": [ "js", "vue" ], "transform": { "^.+\\.js$": "<rootDir>/node_modules/babel-jest", "^.+\\.vue$": "<rootDir>/node_modules/vue-preprocessor" } }
-
Start writing test that can import
*.vue
components. -
Cover your files!