vue 2 jest coverage is incorrect

1.2k views Asked by At

I have setup unit testing using installation instructions from https://v1.test-utils.vuejs.org/

Tests are running properly. But the coverage is coming incorrectly.

In the report it is showing it has only 1 statement, 1 function, 2 branches for some reason.

It's not showing coverage for all the lines. It shows coverage in the first line and doesn't show coverage anywhere else. Don't know what's the issue is here.

I'm using Bootstrap-vue to render components. Can this create an issue with coverage? I'm asking this because the example.spec.js that came for the helloworld component is showing coverage correctly.

enter image description here

my dev dependencies

"devDependencies": {
    "@babel/core": "^7.12.16",
    "@babel/eslint-parser": "^7.12.16",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-plugin-unit-jest": "^5.0.4",
    "@vue/cli-service": "~5.0.0",
    "@vue/test-utils": "^1.3.0",
    "@vue/vue2-jest": "^27.0.0-alpha.2",
    "babel-jest": "^27.0.6",
    "eslint": "^7.32.0",
    "eslint-plugin-vue": "^8.0.3",
    "flush-promises": "^1.0.2",
    "jest": "^27.0.5",
    "node-sass": "^7.0.1",
    "sass-loader": "^12.6.0",
    "vue-template-compiler": "^2.6.14"
  },
0

There are 0 answers