-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Labels
Description
package.json
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1",
"@commitlint/cli": "^7.3.2",
"@commitlint/config-conventional": "^7.3.1",
"@vue/cli-plugin-babel": "^3.4.0",
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-plugin-unit-jest": "^3.4.0",
"@vue/cli-service": "^3.4.0",
"@vue/eslint-config-prettier": "^4.0.1",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/test-utils": "^1.0.0-beta.20",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"eslint": "^5.8.0",
"eslint-plugin-jest": "^22.2.2",
"eslint-plugin-vue": "^5.0.0",
"jest-junit": "^6.0.1",
"jest-transform-stub": "^1.0.0",
"jest-vue-preprocessor": "^1.4.0",
"node-sass": "^4.11.0",
"prettier": "^1.15.3",
"sass-loader": "^7.1.0",
"vue-jest": "^4.0.0-beta.0",
"vue-template-compiler": "^2.5.21"
jest.config.js
module.exports = {
moduleFileExtensions: ['js', 'json', 'vue'],
transform: {
'^.+\\.vue$': '<rootDir>/node_modules/vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': '<rootDir>/node_modules/jest-transform-stub',
'^.+\\.js?$': '<rootDir>/node_modules/babel-jest',
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
roots: ['<rootDir>/src/'],
collectCoverage: true,
coverageDirectory: '<rootDir>/reports/coverage',
reporters: ['default', ['jest-junit', { output: './reports/junit.xml' }]],
coverageReporters: ['json-summary', 'lcov', 'text', 'text-summary'],
collectCoverageFrom: ['**/*.{js,vue}'],
cache: false,
snapshotSerializers: ['jest-serializer-vue'],
testURL: 'http://localhost/',
testMatch: ['**/__tests__/**/*.js', '**/?(*.)+(spec|test).js'],
globals: {
'vue-jest': {
babelConfig: '<rootDir>/.babelrc',
},
__DEV__: true,
CSInterface: class CSInterface {},
},
};
.babelrc
{
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}
]
],
"plugins": ["@babel/plugin-transform-runtime"],
"env": {
"test": {
"presets": ["@babel/preset-env"]
}
}
}
I'm using the command vue-cli-service test:unit --no-cache to run tests. All the tests run, but coverage is not collected from anything in the component subdir from within src. This means most of my tests are not collecting coverage.
I'm also having an issue with the jest global I have set up in my jest config not actually working. Nothing I do to my set up seems to fix either of these issues.