Gathering detailed insights and metrics for vue-jest
Gathering detailed insights and metrics for vue-jest
Gathering detailed insights and metrics for vue-jest
Gathering detailed insights and metrics for vue-jest
npm install vue-jest
Typescript
Module System
JavaScript (73.03%)
Vue (23.67%)
TypeScript (2.05%)
SCSS (0.42%)
Less (0.3%)
Pug (0.16%)
Sass (0.14%)
HTML (0.13%)
CSS (0.07%)
Stylus (0.04%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
757 Stars
521 Commits
157 Forks
19 Watchers
17 Branches
139 Contributors
Updated on Jun 26, 2025
Latest Version
3.0.7
Package Id
vue-jest@3.0.7
Size
10.97 kB
Published on
Sep 14, 2020
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
11
3
25
Jest Vue transformer with source map support
NOTE: This is documentation for
vue-jest@3.x
. View the vue-jest@2.x documentation
1npm install --save-dev vue-jest
To define vue-jest
as a transformer for your .vue
files, map them to the vue-jest
module:
1{ 2 "jest": { 3 "transform": { 4 "^.+\\.vue$": "vue-jest" 5 } 6}
A full config will look like this.
1{ 2 "jest": { 3 "moduleFileExtensions": [ 4 "js", 5 "json", 6 "vue" 7 ], 8 "transform": { 9 "^.+\\.js$": "babel-jest", 10 "^.+\\.vue$": "vue-jest" 11 } 12 } 13}
If you're on a version of Jest older than 22.4.0, you need to set mapCoverage
to true
in order to use source maps.
Example repositories testing Vue components with jest and vue-jest:
vue-jest compiles the script and template of SFCs into a JavaScript file that Jest can run. Currently, SCSS, SASS and Stylus are the only style languages that are compiled.
lang="ts"
, lang="typescript"
)lang="coffee"
, lang="coffeescript"
)You can change the behavior of vue-jest
by using jest.globals
.
Tip: Need programmatic configuration? Use the --config option in Jest CLI, and export a
.js
file
Provide babelConfig
in one of the following formats:
<Boolean>
<Object>
<String>
true
- Enable Babel processing. vue-jest
will try to find Babel configuration using find-babel-config.This is the default behavior if babelConfig is not defined.
false
- Skip Babel processing entirely:1{ 2 "jest": { 3 "globals": { 4 "vue-jest": { 5 "babelConfig": false 6 } 7 } 8 } 9}
Provide inline Babel options:
1{ 2 "jest": { 3 "globals": { 4 "vue-jest": { 5 "babelConfig": { 6 "presets": [ 7 [ 8 "env", 9 { 10 "useBuiltIns": "entry", 11 "shippedProposals": true 12 } 13 ] 14 ], 15 "plugins": [ 16 "syntax-dynamic-import" 17 ], 18 "env": { 19 "test": { 20 "plugins": [ 21 "dynamic-import-node" 22 ] 23 } 24 } 25 } 26 } 27 } 28 } 29}
If a string is provided, it will be an assumed path to a babel configuration file (e.g. .babelrc
, .babelrc.js
).
1{ 2 "jest": { 3 "globals": { 4 "vue-jest": { 5 "babelConfig": "path/to/.babelrc.js" 6 } 7 } 8 } 9}
To use the Config Function API, use inline options instead. i.e.:
1{ 2 "jest": { 3 "globals": { 4 "vue-jest": { 5 "babelConfig": { 6 "configFile": "path/to/babel.config.js" 7 } 8 } 9 } 10 } 11}
Provide tsConfig
in one of the following formats:
<Boolean>
<Object>
<String>
true
- Process TypeScript files using custom configuration. vue-jest
will try to find TypeScript configuration using tsconfig.loadSync.This is the default behavior if tsConfig is not defined.
false
- Process TypeScript files using the default configuration provided by vue-jest.Provide inline TypeScript compiler options:
1{ 2 "jest": { 3 "globals": { 4 "vue-jest": { 5 "tsConfig": { 6 "importHelpers": true 7 } 8 } 9 } 10 } 11}
If a string is provided, it will be an assumed path to a TypeScript configuration file:
1{ 2 "jest": { 3 "globals": { 4 "vue-jest": { 5 "tsConfig": "path/to/tsconfig.json" 6 } 7 } 8 } 9}
pug (lang="pug"
)
1 { 2 "jest": { 3 "globals": { 4 "vue-jest": { 5 "pug": { 6 "basedir": "mybasedir" 7 } 8 } 9 } 10 } 11 }
jade (lang="jade"
)
haml (lang="haml"
)
lang="stylus"
, lang="styl"
)lang="sass"
)
lang="scss"
)
The SCSS compiler supports jest's moduleNameMapper which is the suggested way of dealing with Webpack aliases.
To import globally included files (ie. variables, mixins, etc.), include them in the Jest configuration at jest.globals['vue-jest'].resources.scss
:
1{ 2 "jest": { 3 "globals": { 4 "vue-jest": { 5 "resources": { 6 "scss": [ 7 "./node_modules/package/_mixins.scss", 8 "./src/assets/css/globals.scss" 9 ] 10 } 11 } 12 } 13 } 14}
lang="pcss"
, lang="postcss"
)experimentalCSSCompile
: Boolean
Default true. Turn off CSS compilation
hideStyleWarn
: Boolean
Default false. Hide warnings about CSS compilation
resources
:
1{ 2 "jest": { 3 "globals": { 4 "vue-jest": { 5 "hideStyleWarn": true, 6 "experimentalCSSCompile": true 7 } 8 } 9 } 10}
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 18/29 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
56 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More