# vue-jest **Repository Path**: web_lh/vue-jest ## Basic Information - **Project Name**: vue-jest - **Description**: Jest Vue transformer - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-08-22 - **Last Updated**: 2022-08-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vue-jest Jest transformer for Vue Single File Components. ## Installation Since we need to support a variety of Vue and Jest versions, vue-jest doesn't follow semantic versioning. | Vue version | Jest Version | npm Package | Branch | | ----------- | ----------------- | ------------------- | ------ | | Vue 2 | Jest 26 and below | `vue-jest@4` | | | Vue 3 | Jest 26 and below | `vue-jest@5` | | | Vue 2 | Jest 27 and above | `@vue/vue2-jest@27` | 27.x | | Vue 3 | Jest 27 and above | `@vue/vue3-jest@27` | 27.x | | Vue 2 | Jest 28 and above | `@vue/vue2-jest@28` | 28.x | | Vue 3 | Jest 28 and above | `@vue/vue3-jest@28` | 28.x | ```bash # Vue 2 npm install --save-dev @vue/vue2-jest@28 # (use the appropriate version) yarn add @vue/vue2-jest@28 --dev # Vue 3 npm install --save-dev @vue/vue3-jest@28 # (use the appropriate version) yarn add @vue/vue3-jest@28 --dev ``` ## Setup To use `vue-jest` as a transformer for your `.vue` files, map them to the appropriate `vue-jest` module: ```json { "jest": { "transform": { "^.+\\.vue$": "@vue/vue2-jest" // Update to match your installed version } } } ``` A full config will look like this. ```json { "jest": { "moduleFileExtensions": ["js", "json", "vue"], "transform": { "^.+\\.js$": "babel-jest", "^.+\\.vue$": "@vue/vue2-jest" } } } ``` ### Usage with Babel 7 If you use [jest](https://github.com/facebook/jest) > 24.0.0 and [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest) make sure to install babel-core@bridge ```bash npm install --save-dev babel-core@bridge yarn add babel-core@bridge --dev ``` ## Supported languages for SFC sections vue-jest compiles `