Skip to content

Commit b5f7df3

Browse files
committed
move vue-jest configs to jest globals
1 parent f4d1a2e commit b5f7df3

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,20 @@ vue-jest compiles the script and template of SFCs into a JavaScript file that Je
6464

6565
- **stylus** (`lang="stylus"`, `lang="styl"`)
6666
- **scss** (`lang="scss"`)
67-
- To import globally included files (ie. variables, mixins, etc.), include them in the `vueJest` configuration resources:
68-
```
67+
- To import globally included files (ie. variables, mixins, etc.), include them in the Jest configuration at `jest.globals['vue-jest'].resources.scss`:
68+
```js
6969
// package.json
7070
{
71-
"vueJest": {
72-
resources: {
73-
"scss": [
74-
"./node_modules/package/_mixins.scss",
75-
"./src/assets/css/globals.scss"
76-
]
71+
"jest": {
72+
"globals": {
73+
"vue-jest": {
74+
"resources": {
75+
"scss": [
76+
"./node_modules/package/_mixins.scss",
77+
"./src/assets/css/globals.scss"
78+
]
79+
}
80+
}
7781
}
7882
}
7983
}

lib/load-config.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/process.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const path = require('path')
1212
const join = path.join
1313
const logger = require('./logger')
1414
const splitRE = /\r?\n/g
15-
const config = require('./load-config')()
1615

1716
function processScript (scriptPart) {
1817
if (!scriptPart) {
@@ -40,7 +39,11 @@ function changePartsIfFunctional (parts) {
4039
}
4140
}
4241

43-
module.exports = function (src, filePath) {
42+
module.exports = function (src, filePath, jestConfig) {
43+
const config = jestConfig && jestConfig.globals
44+
? jestConfig.globals['vue-jest']
45+
: {}
46+
4447
var parts = vueCompiler.parseComponent(src, { pad: true })
4548

4649
changePartsIfFunctional(parts)

0 commit comments

Comments
 (0)