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
+25-30
Original file line number
Diff line number
Diff line change
@@ -28,11 +28,7 @@ A full config will look like this.
28
28
```json
29
29
{
30
30
"jest": {
31
-
"moduleFileExtensions": [
32
-
"js",
33
-
"json",
34
-
"vue"
35
-
],
31
+
"moduleFileExtensions": ["js", "json", "vue"],
36
32
"transform": {
37
33
"^.+\\.js$": "babel-jest",
38
34
"^.+\\.vue$": "vue-jest"
@@ -63,7 +59,7 @@ vue-jest compiles the script and template of SFCs into a JavaScript file that Je
63
59
64
60
You can change the behavior of `vue-jest` by using `jest.globals`.
65
61
66
-
> *Tip:* Need programmatic configuration? Use the [--config](https://jestjs.io/docs/en/cli.html#config-path) option in Jest CLI, and export a `.js` file
62
+
> _Tip:_ Need programmatic configuration? Use the [--config](https://jestjs.io/docs/en/cli.html#config-path) option in Jest CLI, and export a `.js` file
67
63
68
64
#### babelConfig
69
65
@@ -112,14 +108,10 @@ Provide inline [Babel options](https://babeljs.io/docs/en/options):
112
108
}
113
109
]
114
110
],
115
-
"plugins": [
116
-
"syntax-dynamic-import"
117
-
],
111
+
"plugins": ["syntax-dynamic-import"],
118
112
"env": {
119
113
"test": {
120
-
"plugins": [
121
-
"dynamic-import-node"
122
-
]
114
+
"plugins": ["dynamic-import-node"]
123
115
}
124
116
}
125
117
}
@@ -132,8 +124,9 @@ Provide inline [Babel options](https://babeljs.io/docs/en/options):
132
124
##### String
133
125
134
126
If a string is provided, it will be an assumed path to a babel configuration file (e.g. `.babelrc`, `.babelrc.js`).
127
+
135
128
- Config file should export a Babel configuration object.
136
-
- Should *not* point to a [project-wide configuration file (babel.config.js)](https://babeljs.io/docs/en/config-files#project-wide-configuration), which exports a function.
129
+
- Should _not_ point to a [project-wide configuration file (babel.config.js)](https://babeljs.io/docs/en/config-files#project-wide-configuration), which exports a function.
137
130
138
131
```json
139
132
{
@@ -216,21 +209,22 @@ If a string is provided, it will be an assumed path to a TypeScript configuratio
216
209
### Supported template languages
217
210
218
211
- **pug** (`lang="pug"`)
212
+
219
213
- To give options for the Pug compiler, enter them into the Jest configuration.
220
-
The options will be passed to pug.compile().
214
+
The options will be passed to pug.compile().
221
215
222
216
```json
223
-
{
224
-
"jest": {
225
-
"globals": {
226
-
"vue-jest": {
227
-
"pug": {
228
-
"basedir": "mybasedir"
229
-
}
217
+
{
218
+
"jest": {
219
+
"globals": {
220
+
"vue-jest": {
221
+
"pug": {
222
+
"basedir": "mybasedir"
230
223
}
231
224
}
232
225
}
233
226
}
227
+
}
234
228
```
235
229
236
230
- **jade** (`lang="jade"`)
@@ -242,6 +236,7 @@ If a string is provided, it will be an assumed path to a TypeScript configuratio
242
236
- **sass** (`lang="sass"`)
243
237
- The SASS compiler supports jest's [moduleNameMapper](https://facebook.github.io/jest/docs/en/configuration.html#modulenamemapper-object-string-string) which is the suggested way of dealing with Webpack aliases.
244
238
- **scss** (`lang="scss"`)
239
+
245
240
- The SCSS compiler supports jest's [moduleNameMapper](https://facebook.github.io/jest/docs/en/configuration.html#modulenamemapper-object-string-string) which is the suggested way of dealing with Webpack aliases.
246
241
- To import globally included files (ie. variables, mixins, etc.), include them in the Jest configuration at `jest.globals['vue-jest'].resources.scss`:
247
242
@@ -268,15 +263,15 @@ If a string is provided, it will be an assumed path to a TypeScript configuratio
268
263
`hideStyleWarn`: `Boolean` Default false. Hide warnings about CSS compilation
// Extract the moduleNameMapper settings from the jest config. TODO: In case of development via babel@7, somehow the jestConfig.moduleNameMapper might end up being an Array. After a proper upgrade to babel@7 we should probably fix this.
logger.warn(`There was an error rendering the SASS in ${filePath}. SASS is fully supported by vue-jest. Still some features might throw errors. Webpack aliases are a common cause of errors. If you use Webpack aliases, please use jest's suggested way via moduleNameMapper which is supported.`)
38
+
logger.warn(
39
+
`There was an error rendering the SASS in ${filePath}. SASS is fully supported by vue-jest. Still some features might throw errors. Webpack aliases are a common cause of errors. If you use Webpack aliases, please use jest's suggested way via moduleNameMapper which is supported.`
40
+
)
31
41
logger.warn(`Error while compiling styles: ${err}`)
logger.warn(`There was an error rendering the SCSS in ${filePath}. SCSS is fully supported by vue-jest. Still some features might throw errors. Webpack aliases are a common cause of errors. If you use Webpack aliases, please use jest's suggested way via moduleNameMapper which is supported.`)
48
+
logger.warn(
49
+
`There was an error rendering the SCSS in ${filePath}. SCSS is fully supported by vue-jest. Still some features might throw errors. Webpack aliases are a common cause of errors. If you use Webpack aliases, please use jest's suggested way via moduleNameMapper which is supported.`
50
+
)
41
51
logger.warn(`Error while compiling styles: ${err}`)
0 commit comments