Skip to content

Commit f6ccd58

Browse files
committed
build: update jest config
1 parent b37b816 commit f6ccd58

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

jest.config.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
const scope = process.argv[2] || ''
2+
13
module.exports = {
24
setupFiles: ['<rootDir>/test/jest.init.js'],
3-
testMatch: [
4-
'**/jest-test/**/*.spec.js'
5-
],
65
moduleFileExtensions: [
76
'js',
87
'json',
@@ -11,8 +10,9 @@ module.exports = {
1110
transform: {
1211
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
1312
'jest-transform-stub',
14-
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
15-
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
13+
'^.+\\.js$': 'babel-jest',
14+
'.*\\.vue$': 'vue-jest',
15+
'^.+\\.svg$': 'jest-svg-sprite-loader'
1616
},
1717
globals: {
1818
'vue-jest': {
@@ -21,23 +21,24 @@ module.exports = {
2121
}
2222
}
2323
},
24-
collectCoverage: true,
25-
collectCoverageFrom: [
26-
'components/*/*.{js,vue}'
27-
],
2824
modulePaths: [
2925
'<rootDir>/components',
3026
'<rootDir>/node_modules'
3127
],
3228
moduleNameMapper: {
29+
'@examples(.*)': '<rootDir>/examples/$1',
3330
'mand-mobile(.*)': '<rootDir>/$1',
3431
'mand-mobile/lib(.*)': '<rootDir>/components$1'
3532
},
33+
snapshotSerializers: [
34+
'jest-serializer-vue'
35+
],
36+
collectCoverage: !scope,
37+
collectCoverageFrom: [
38+
'components/*/*.{js,vue}'
39+
],
3640
coverageReporters: [
3741
'html',
3842
'text-summary'
39-
],
40-
snapshotSerializers: [
41-
'jest-serializer-vue'
4243
]
4344
}

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@
3636
"build:mand-mobile-special": "cross-env NODE_ENV=production BUILD_TYPE=special node build/rollup/build-mand-mobile.rollup",
3737
"build:components": "cross-env NODE_ENV=production && node build/rollup/build-component.rollup",
3838
"build:analysis": "cross-env NODE_ENV=production node build/webpack/build-mand-mobile --analysis",
39-
"test": "cross-env NODE_ENV=testing BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
40-
"test:rollup": "cross-env NODE_ENV=testing BABEL_ENV=test karma start test/unit/rollup.karma.conf.js --auto-watch",
4139
"lint": "eslint --ext .js,.vue components test/unit/specs test/e2e/specs",
4240
"precommit": "lint-staged",
4341
"build:webpack": "rm -rf ./lib && npm run build:webpack:mand-mobile && npm run build:webpack:components",
4442
"build:webpack:example": "cross-env NODE_ENV=production node build/webpack/build-example",
4543
"build:webpack:mand-mobile": "cross-env NODE_ENV=production node build/webpack/build-mand-mobile",
4644
"build:webpack:components": "cross-env NODE_ENV=production gulp build --gulpfile gulpfile.js && node build/webpack/build-style-entry",
4745
"codecov": "codecov",
48-
"jest": "cross-env NODE_ENV=test jest"
46+
"test": "cross-env NODE_ENV=testing jest --no-cache"
4947
},
5048
"license": "Apache",
5149
"config": {
@@ -144,6 +142,7 @@
144142
"inquirer": "^3.3.0",
145143
"jest": "^23.6.0",
146144
"jest-serializer-vue": "^2.0.2",
145+
"jest-svg-sprite-loader": "^1.0.1",
147146
"jest-transform-stub": "^1.0.0",
148147
"karma": "^1.4.1",
149148
"karma-chrome-launcher": "^2.2.0",

0 commit comments

Comments
 (0)