Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(coverage): improve coverage config #609

Merged
merged 1 commit into from
May 16, 2021

Conversation

leonardobazico
Copy link
Contributor

@leonardobazico leonardobazico commented May 14, 2021

Description

I've noticed that the test coverage is collecting data from dist and src.

Motivation and Context

Improve the collaboration experience and maintenance.
It will also enable a better yarn test --watch usability, cause the test-kit will look for the source code.

Previous coverage result

---------------------------|---------|----------|---------|---------|------------------------------------------
File                       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                        
---------------------------|---------|----------|---------|---------|------------------------------------------
All files                  |   84.66 |    72.65 |   82.07 |   84.95 |                                          
 dist                      |    90.8 |    74.63 |   92.86 |   90.94 |                                          
  _handlers.js             |   91.18 |       68 |     100 |   91.18 | 48,54,65                                 
  config-factory.js        |   96.88 |    82.61 |     100 |   96.88 | 38                                       
  context-matcher.js       |   94.44 |       90 |     100 |   94.44 | 25,32                                    
  errors.js                |     100 |      100 |     100 |     100 |                                          
  http-proxy-middleware.js |    96.2 |    83.67 |     100 |    96.2 | 101-102,125                              
  index.js                 |   84.21 |    68.75 |      80 |   85.71 | 6-7                                      
  logger.js                |   70.69 |       50 |   81.25 |   70.18 | 38,42,51-52,73,81,118-133                
  path-rewriter.js         |   97.06 |    81.25 |     100 |   97.06 | 51                                       
  router.js                |     100 |       90 |     100 |     100 | 13                                       
 dist/handlers             |   43.21 |    52.63 |   33.33 |   42.25 |                                          
  fix-request-body.js      |   92.86 |       90 |     100 |   92.86 | 10                                       
  index.js                 |   78.57 |    68.75 |      75 |   77.78 | 6-7                                      
  public.js                |    87.5 |      100 |      50 |     100 |                                          
  response-interceptor.js  |    8.89 |        0 |       0 |    9.52 | 13-31,41-84                              
 src                       |   89.53 |    77.84 |   90.38 |   89.49 |                                          
  _handlers.ts             |   96.88 |       96 |      75 |   96.88 | 87                                       
  config-factory.ts        |   93.33 |    82.61 |     100 |   93.33 | 84,88                                    
  context-matcher.ts       |     100 |      100 |     100 |     100 |                                          
  errors.ts                |     100 |      100 |     100 |     100 |                                          
  http-proxy-middleware.ts |   63.64 |    32.65 |   63.64 |   63.64 | ...96-99,141-147,164-168,176-181,187-194 
  index.ts                 |     100 |      100 |     100 |     100 |                                          
  logger.ts                |     100 |       95 |     100 |     100 | 72-78                                    
  path-rewriter.ts         |     100 |    93.75 |     100 |     100 | 57                                       
  router.ts                |     100 |      100 |     100 |     100 |                                          
 src/handlers              |      80 |    45.45 |   71.43 |   78.18 |                                          
  fix-request-body.ts      |   16.67 |        0 |       0 |   16.67 | 9-25                                     
  index.ts                 |     100 |      100 |     100 |     100 |                                          
  public.ts                |     100 |      100 |      50 |     100 |                                          
  response-interceptor.ts  |   95.35 |    83.33 |      90 |      95 | 48,109                                   
 test/e2e                  |     100 |      100 |      80 |     100 |                                          
  test-kit.ts              |     100 |      100 |      80 |     100 |                                          
---------------------------|---------|----------|---------|---------|------------------------------------------

Coverage result after config changes

---------------------------|---------|----------|---------|---------|-------------------
File                       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
---------------------------|---------|----------|---------|---------|-------------------
All files                  |   98.31 |    91.79 |   98.48 |   98.29 |                   
 src                       |   98.99 |    92.43 |     100 |   98.98 |                   
  _handlers.ts             |     100 |       96 |     100 |     100 | 70                
  config-factory.ts        |     100 |     91.3 |     100 |     100 | 29,79             
  context-matcher.ts       |     100 |      100 |     100 |     100 |                   
  errors.ts                |     100 |      100 |     100 |     100 |                   
  http-proxy-middleware.ts |    96.1 |    83.67 |     100 |    96.1 | 141-147,181       
  index.ts                 |     100 |      100 |     100 |     100 |                   
  logger.ts                |     100 |       95 |     100 |     100 | 72-78             
  path-rewriter.ts         |     100 |    93.75 |     100 |     100 | 57                
  router.ts                |     100 |      100 |     100 |     100 |                   
 src/handlers              |      95 |    86.36 |   92.86 |   94.55 |                   
  fix-request-body.ts      |   91.67 |       90 |     100 |   91.67 | 10                
  index.ts                 |     100 |      100 |     100 |     100 |                   
  public.ts                |     100 |      100 |     100 |     100 |                   
  response-interceptor.ts  |   95.35 |    83.33 |      90 |      95 | 48,109            
---------------------------|---------|----------|---------|---------|-------------------

How has this been tested?

Not need

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@coveralls
Copy link

Coverage Status

Coverage increased (+13.3%) to 98.286% when pulling 3cda05a on leonardobazico:coverage into c935888 on chimurai:master.

@chimurai
Copy link
Owner

Thanks, this was on my TODO list.

This reason for testing dist was due this little annoying TypeScript behaviour:

// https://github.com/Microsoft/TypeScript/wiki/'this'-in-TypeScript#red-flags-for-this
public middleware: RequestHandler = async (

Testing it purely in typescript src didn't caught this issue.

Think it makes sense to create a separate dist test, so it doesn't affect the developer experience.

@chimurai chimurai merged commit a6f8e0d into chimurai:master May 16, 2021
@leonardobazico leonardobazico deleted the coverage branch May 18, 2021 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants