question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Coverage isn't calculated properly for non-SFC

See original GitHub issue

Version

3.0.5

Reproduction link

https://github.com/dmitriykirpa/vue-cli-jest-coverage-example

Environment info

  System:
    OS: macOS 10.15.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 14.2.0 - /usr/local/bin/node
    Yarn: 1.21.0 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 81.0.4044.138
    Firefox: 70.0.1
    Safari: 13.1
  npmPackages:
    @vue/cli-overlay:  4.3.1 
    @vue/cli-plugin-eslint: ^4.3.0 => 4.3.1 
    @vue/cli-plugin-router:  4.3.1 
    @vue/cli-plugin-unit-jest: ^4.3.0 => 4.3.1 
    @vue/cli-plugin-vuex:  4.3.1 
    @vue/cli-service: ^4.3.0 => 4.3.1 
    @vue/cli-shared-utils:  4.3.1 
    @vue/component-compiler-utils:  3.1.2 
    @vue/eslint-config-prettier: ^6.0.0 => 6.0.0 
    @vue/preload-webpack-plugin:  1.1.1 
    @vue/test-utils: 1.0.0-beta.31 => 1.0.0-beta.31 
    @vue/web-component-wrapper:  1.2.0 
    eslint-plugin-vue: ^6.2.2 => 6.2.2 
    jest-serializer-vue:  2.0.2 
    vue: ^2.6.11 => 2.6.11 
    vue-eslint-parser:  7.1.0 
    vue-hot-reload-api:  2.3.4 
    vue-jest:  3.0.5 
    vue-loader:  15.9.2 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.6.11 => 2.6.11 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

  1. Create a new vue-cli project (or configure it manually) with vue-jest configured.
  2. Move the script section from the src/components/HelloWorld.vue to a separate file script.js.
  3. Add the <script src="./script.js" /> to src/components/HelloWorld.vue
  4. Run yarn/npm run test:unit --coverage
  5. Observe the result.

What is expected?

Coverage for script.js calculated properly

What is actually happening?

Coverage for script.js is 0

image

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jrkienlecommented, Sep 23, 2020

I’m experiencing the same issue, has there been any progress on this?

0reactions
lmiller1990commented, Mar 15, 2021

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Coverage Not Be Calculated - SonarQube - Sonar Community
We have been using SonarQube for a long time. There is a problem with calculation of coverage . I trigged a build request...
Read more >
Frequently Asked Questions on the Code on Unit Trusts ... - SFC
An SFC-authorized fund is not expected to invest more than 10% of its net asset value (“NAV”) in ILS Investments. • Regardless of...
Read more >
B7-3-06, Flood Insurance Requirements for All Property Types ...
Flood insurance is not required on a principal or residential detached ... SFC 180 No Flood Insurance — Not a Special Flood Hazard...
Read more >
Survey of Consumer Finances (SCF) - Federal Reserve Board
To ensure that your question is properly routed, please select the Survey of Consumer Finances as the "Economic Data" and select no other...
Read more >
How do I increase my code coverage, or why can't I cover ...
For purposes of calculating code coverage, only executable lines of ... loop never begins iterating because the query returns no records.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found