jest-vue-preprocessor | allows importing of .vue files | State Container library
kandi X-RAY | jest-vue-preprocessor Summary
kandi X-RAY | jest-vue-preprocessor Summary
Preprocessor that allows importing of .vue files in jest tests
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates a new render plugin .
jest-vue-preprocessor Key Features
jest-vue-preprocessor Examples and Code Snippets
Community Discussions
Trending Discussions on jest-vue-preprocessor
QUESTION
I'm trying to rollup Vue component lib, written on the typescript + vue-property-decorator. I have several Vue components, and plugin class in a separated file, where the components are imported:
...ANSWER
Answered 2020-Oct-11 at 13:52That tsconfig contains paths
affects only how TypeScript compiler resolves modules but doesn't replace aliased import paths in JS output. It's possible for tools to transparently process files with a respect to paths
option but this shouldn't be expected.
Module aliasing for the bundle can be addressed by another Rollup plugin like @rollup/plugin-alias
. This reveals the problem with the latest @rollup/plugin-typescript
that results in processing errors when it's used with other plugins.
A way to make this setup workable is to switch to another TypeScript plugin, rollup-plugin-typescript2
:
QUESTION
i use a codebase made with Vue3 Vite, but i cannot find a way to run a simple Jest test importing a component. This works fine in an app create with Vue-cli, but i cannot find a way to make Jest work in a Vue-Vite app with Vue3. Here is the error I encounter
...ANSWER
Answered 2020-Nov-03 at 16:10The packages for Vue 3 all use different names while they are in beta. You are looking for this package: https://www.npmjs.com/package/@vue/compiler-sfc
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jest-vue-preprocessor
add package you your project
yarn add --dev jest-vue-preprocessor or npm install --saveDev jest-vue-preprocessor
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" } }
Start writing test that can import *.vue components - see example ./tests/index.spec.js
Profit!
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page