Open dmytrokirpa opened 4 years ago
Hi! Thanks fore this.
I started to work on this repo (around 1 month? 2 months?) ago. I am not super familiar with how this all works yet, but I would like to start digging into it more and closing out some of these long standing issues.
Happy to help out if you would like to give it a shot, too.
Same error.
I'm using @vue/cli-plugin-unit-jest
, with this jest.config.js
:
module.exports = {
preset : '@vue/cli-plugin-unit-jest',
transformIgnorePatterns : ['node_modules/(?!(?:@babel|place|folders|here))'],
setupFilesAfterEnv : ['./tests/unit/jest.setup.js'],
collectCoverage : true,
collectCoverageFrom : ['src/**/*.{js,vue}', '!**/__DEMO/**', '!**/vendor/**'],
coverageDirectory : '<rootDir>/coverage',
coveragePathIgnorePatterns : ['/node_modules/', '/src/main.m?js', '/src/index.m?js', '/src/lang', '/src/locale', '/__DEMO/', '/src/manage/'],
coverageThreshold : {
global : {
branches : 90,
functions : 90,
lines : 90,
statements : -10
}
}
};
When i run test everything is ok but coverage report not show correct info.
If i see html report file .vue
contains js code and 100% passed, and .js
file is marked like not passed.
Summary:
file .vue:
file .js:
I'm experiencing the same issue, has there been any progress on this?
Which version of vue-jest are you using @jrkienle ? 3 or 4 (or 5?)
same issue is using vue-jest v3.0.6
Can you please upgrade to v4 and see how that goes? That is the latest version (works with Vue 2).
Same problem for me, I'm using v4.0.0 beta 6.
Same with v5...
If anyone is super motivated to tackle this I can try to help out, I have many other higher priority bugs like proper TS support, releasing Test Utils v2, etc, so I was not able to tackle this.
As far as I can see it's (mostly) working ok for SFCs? Is this just for non sfc components? Is the main use case JSX/TSX?
Version
3.0.5
Reproduction link
https://github.com/dmitriykirpa/vue-cli-jest-coverage-example
Environment info
Steps to reproduce
vue-cli
project (or configure it manually) withvue-jest
configured.script
section from thesrc/components/HelloWorld.vue
to a separate filescript.js
.<script src="./script.js" />
tosrc/components/HelloWorld.vue
yarn/npm run test:unit --coverage
What is expected?
Coverage for
script.js
calculated properlyWhat is actually happening?
Coverage for
script.js
is0