You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-25
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,32 @@
1
1
# vue-jest
2
2
3
-
Jest transformer for Vue single file components
3
+
Jest transformer for Vue Single File Components.
4
4
5
-
> **NOTE:** This is documentation for `[email protected]`. [View the [email protected] documentation](https://github.com/vuejs/vue-jest/tree/v3)
5
+
## Installation
6
6
7
-
## Usage
7
+
Since we need to support a variety of Vue and Jest versions, vue-jest doesn't follow semantic versioning.
8
8
9
-
```bash
10
-
npm install --save-dev vue-jest
11
-
yarn add vue-jest --dev
12
-
```
13
-
14
-
### Usage with Babel 7
15
-
16
-
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
npm install --save-dev @vue/vue2-jest@27 # (use the appropriate version)
18
+
yarn add @vue/vue2-jest@27 --dev
21
19
```
22
20
23
21
## Setup
24
22
25
-
To use `vue-jest` as a transformer for your `.vue` files, map them to the `vue-jest` module:
23
+
To use `vue-jest` as a transformer for your `.vue` files, map them to the appropriate `vue-jest` module:
26
24
27
25
```json
28
26
{
29
27
"jest": {
30
28
"transform": {
31
-
"^.+\\.vue$": "vue-jest"
29
+
"^.+\\.vue$": "@vue/vue2-jest"// Update to match your installed version
32
30
}
33
31
}
34
32
}
@@ -42,19 +40,22 @@ A full config will look like this.
42
40
"moduleFileExtensions": ["js", "json", "vue"],
43
41
"transform": {
44
42
"^.+\\.js$": "babel-jest",
45
-
"^.+\\.vue$": "vue-jest"
43
+
"^.+\\.vue$": "@vue/vue2-jest"
46
44
}
47
45
}
48
46
}
49
47
```
50
48
51
-
##Examples
49
+
### Usage with Babel 7
52
50
53
-
Example repositories testing Vue components with jest and vue-jest:
51
+
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
54
52
55
-
-[Vue Test Utils with Jest](https://github.com/eddyerburgh/vue-test-utils-jest-example)
53
+
```bash
54
+
npm install --save-dev babel-core@bridge
55
+
yarn add babel-core@bridge --dev
56
+
```
56
57
57
-
## Supported langs
58
+
## Supported languages for SFC sections
58
59
59
60
vue-jest compiles `<script />`, `<template />`, and `<style />` blocks with supported `lang` attributes into JavaScript that Jest can run.
0 commit comments