Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

vue-template-loader-jest

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Issues
File Explorer

Advanced tools

vue-template-loader-jest

Missing link between vue-template-loader and jest

    0.1.0latest

Version published
Maintainers
1
Yearly downloads
14,714
decreased by-39.55%

Weekly downloads

Readme

Source

Vue Template Loader Jest

With vue-template-loader it is possible to extract the html from a typescript single file component to a separate .html file (see https://github.com/ktsn/vue-template-loader). But loading the components in jest tests is not possible anymore.

Here this library comes into play. It is basically just a custom transformer for jest that is using vue-template-loader to compile the template.

Reception

This is untested at all and I only care about my issues. Contributors are highly welcome. Feel free to open pull requests and issues. Write when you are interested in maintaining it.

Usage

Just install this library and add it to your jest config .*html: 'vue-template-loader-jest'. Example:

{ "jest": { "moduleFileExtensions": [ "js", "ts", "html" ], "transform": { "^.+\\.tsx?$": "ts-jest", "^.+\\.html$": "vue-template-loader-jest" }, "moduleNameMapper": { "@view/(.*)": "<rootDir>/resources/views/components/$1" } } }

As you can see I'm also using a custom alias for views.

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc