Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #1554
Closed
Open
Issue created Feb 14, 2017 by Administrator@rootContributor

Coverage is not reported accurately when filename is similar to the folder name

Created by: MrHus

Description

When I run npm test -- --coverage some files report zero coverage, even though they have tests.

Here is the output:

-------------------------------------------|----------|----------|----------|----------|----------------|
File                                       |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
-------------------------------------------|----------|----------|----------|----------|----------------|
All files                                  |    91.94 |    71.43 |    93.02 |    92.43 |                |
 src/shared/Pager                          |        0 |        0 |        0 |        0 |                |
  Pager.js                                 |        0 |        0 |        0 |        0 |... 40,41,46,47 |
-------------------------------------------|----------|----------|----------|----------|----------------|

It would seem that the Pager Component is not tested at all. However it is fully tested. Here is the strange thing, when I alter the Pager.js file in anyway, such as entering another blank line or leaving a comment, it will report the following:

-------------------------------------------|----------|----------|----------|----------|----------------|
File                                       |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
-------------------------------------------|----------|----------|----------|----------|----------------|
All files                                  |      100 |      100 |      100 |      100 |                |
 src/shared/Pager                          |      100 |      100 |      100 |      100 |                |
  Pager.js                                 |      100 |      100 |      100 |      100 |                |
-------------------------------------------|----------|----------|----------|----------|----------------|

Things I've tried, without success:

  1. Removing the coverage folder.
  2. Commiting all changes in git so the staging is clear.
  3. Altering the Pager.test.js file.

So far the only solution is changing Pager.js.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): react-scripts@0.9.0
  2. node -v: 7.5.0
  3. npm -v: 4.1.2

Then, specify:

  1. Operating system: macOs Sierra 10.12.3
  2. Browser and version: Not applicable since it is ran inside the terminal

Here's the code for both files: https://gist.github.com/MrHus/add9acb6dee727a494897706570afe12

Assignee
Assign to
Time tracking