OpenBCca / openbc-web

https://openbcca.github.io/openbc-web/
1 stars 2 forks source link

#35 Setup Coverage Reports #60

Closed alchuu00 closed 8 months ago

alchuu00 commented 8 months ago

I am not sure which folders and files should I exclude from the report? Also I am not sure if treshold 80% is okay? Many articles state 80% is good to aim for.

umsu2 commented 8 months ago

i think i mentioned before the test coverage is already setup. it was set at 30pct. i do like we are setting it to 80pct if possible.

alchuu00 commented 8 months ago

@umsu2 I made the changes you suggested to package.json.

alchuu00 commented 8 months ago

Also this is the test output now:

---------------------------|---------|----------|---------|---------|-------------------
File                       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
---------------------------|---------|----------|---------|---------|-------------------
All files                  |   59.59 |     62.5 |    62.5 |   59.57 |                   
 app                       |       0 |      100 |       0 |       0 |                   
  layout.tsx               |       0 |      100 |       0 |       0 | 1-9               
  page.tsx                 |       0 |      100 |       0 |       0 | 2-10              
 app/_component            |       0 |      100 |       0 |       0 | 
  home-page.tsx            |       0 |      100 |       0 |       0 | 1-3
 app/about                 |     100 |      100 |     100 |     100 | 
  page.tsx                 |     100 |      100 |     100 |     100 | 
 app/join-us               |     100 |      100 |     100 |     100 | 
  page.tsx                 |     100 |      100 |     100 |     100 | 
 app/projects              |       0 |      100 |       0 |       0 | 
  page.tsx                 |       0 |      100 |       0 |       0 | 3-29              
 client-services           |     100 |       50 |     100 |     100 | 
  github.client-service.ts |     100 |       50 |     100 |     100 | 29
 components/banner         |     100 |      100 |     100 |     100 | 
  banner.tsx               |     100 |      100 |     100 |     100 | 
 components/footer         |       0 |      100 |       0 |       0 | 
  footer.tsx               |       0 |      100 |       0 |       0 | 3-21
 components/header         |      95 |      100 |      75 |   94.44 | 
  header-data.tsx          |     100 |      100 |     100 |     100 | 
  header.tsx               |   93.75 |      100 |      75 |   93.33 | 26
 components/project        |       0 |        0 |       0 |       0 | 
  project.tsx              |       0 |        0 |       0 |       0 | 3-27              
 mapper                    |     100 |      100 |     100 |     100 | 
  github.mapping.ts        |     100 |      100 |     100 |     100 | 
 utils/header-map          |     100 |      100 |     100 |     100 | 
  header-map.tsx           |     100 |      100 |     100 |     100 | 
---------------------------|---------|----------|---------|---------|-------------------
Jest: "global" coverage threshold for statements (80%) not met: 59.59%
Jest: "global" coverage threshold for branches (80%) not met: 62.5%
Jest: "global" coverage threshold for lines (80%) not met: 59.57%
Jest: "global" coverage threshold for functions (80%) not met: 62.5%

Based on this we need to write additional unit tests for the files above that don't have sufficient coverage. Should I open a new issue and start on that or do I have to make aditional changes to this PR?

SamHuo213 commented 8 months ago

Also this is the test output now:

---------------------------|---------|----------|---------|---------|-------------------
File                       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
---------------------------|---------|----------|---------|---------|-------------------
All files                  |   59.59 |     62.5 |    62.5 |   59.57 |                   
 app                       |       0 |      100 |       0 |       0 |                   
  layout.tsx               |       0 |      100 |       0 |       0 | 1-9               
  page.tsx                 |       0 |      100 |       0 |       0 | 2-10              
 app/_component            |       0 |      100 |       0 |       0 | 
  home-page.tsx            |       0 |      100 |       0 |       0 | 1-3
 app/about                 |     100 |      100 |     100 |     100 | 
  page.tsx                 |     100 |      100 |     100 |     100 | 
 app/join-us               |     100 |      100 |     100 |     100 | 
  page.tsx                 |     100 |      100 |     100 |     100 | 
 app/projects              |       0 |      100 |       0 |       0 | 
  page.tsx                 |       0 |      100 |       0 |       0 | 3-29              
 client-services           |     100 |       50 |     100 |     100 | 
  github.client-service.ts |     100 |       50 |     100 |     100 | 29
 components/banner         |     100 |      100 |     100 |     100 | 
  banner.tsx               |     100 |      100 |     100 |     100 | 
 components/footer         |       0 |      100 |       0 |       0 | 
  footer.tsx               |       0 |      100 |       0 |       0 | 3-21
 components/header         |      95 |      100 |      75 |   94.44 | 
  header-data.tsx          |     100 |      100 |     100 |     100 | 
  header.tsx               |   93.75 |      100 |      75 |   93.33 | 26
 components/project        |       0 |        0 |       0 |       0 | 
  project.tsx              |       0 |        0 |       0 |       0 | 3-27              
 mapper                    |     100 |      100 |     100 |     100 | 
  github.mapping.ts        |     100 |      100 |     100 |     100 | 
 utils/header-map          |     100 |      100 |     100 |     100 | 
  header-map.tsx           |     100 |      100 |     100 |     100 | 
---------------------------|---------|----------|---------|---------|-------------------
Jest: "global" coverage threshold for statements (80%) not met: 59.59%
Jest: "global" coverage threshold for branches (80%) not met: 62.5%
Jest: "global" coverage threshold for lines (80%) not met: 59.57%
Jest: "global" coverage threshold for functions (80%) not met: 62.5%

Based on this we need to write additional unit tests for the files above that don't have sufficient coverage. Should I open a new issue and start on that or do I have to make aditional changes to this PR?

Is there coverage reports that show line by line?

alchuu00 commented 8 months ago

@SamHuo213 I am not sure if I understand what you mean.

Report like this?

Screenshot_3

SamHuo213 commented 8 months ago

@SamHuo213 I am not sure if I understand what you mean.

Report like this?

Screenshot_3

yup, does that get generated?

SamHuo213 commented 8 months ago

Another question, since our coverage does not meet the 80% threshold. What happens?

alchuu00 commented 8 months ago

Another question, since our coverage does not meet the 80% threshold. What happens?

I believe that if our coverage doesn't meet 80% threshold then whenever we try to make pull request merge it will fail.

SamHuo213 commented 8 months ago

Another question, since our coverage does not meet the 80% threshold. What happens?

I believe that if our coverage doesn't meet 80% threshold then whenever we try to make pull request merge it will fail.

That's weird, I don't see any checks.

1) I think we need to ensure that if the coverage is not above 80% it fails the pipeline. 2) I think we need a plan to get our coverage up to 80%

2.1) Either leave it at 30% now and create ticket(s) to add more test and increase it to 80% OR 2.2) Increase it to 80%, let the pipeline give warning. Add tickets to increase it to 80% then change it to fail.

cc: @umsu2

umsu2 commented 8 months ago

Another question, since our coverage does not meet the 80% threshold. What happens?

I believe that if our coverage doesn't meet 80% threshold then whenever we try to make pull request merge it will fail.

That's weird, I don't see any checks.

  1. I think we need to ensure that if the coverage is not above 80% it fails the pipeline.
  2. I think we need a plan to get our coverage up to 80%

2.1) Either leave it at 30% now and create ticket(s) to add more test and increase it to 80% OR 2.2) Increase it to 80%, let the pipeline give warning. Add tickets to increase it to 80% then change it to fail.

cc: @umsu2

no checks because the PR is not up to date with master @alchuu00 let me know when you have time we can go over resolving git conflicts.

umsu2 commented 8 months ago

and in terms of coverage report. it does get generated automatically when we run tests. BUT the coverage report (html) gets thrown away unless we store/host them somewhere.

alchuu00 commented 8 months ago

@umsu2 I removed date from the coverage report filename