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

Chore/issue 47 test coverage develop and serve commands #670

Merged

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Jul 21, 2021

Related Issue

resolves #47

Should get merged after #665

Summary of Changes

  1. Adds ability to test server based commands like develop and server (with help from enable the ability to manage processes that do not close thescientist13/gallinago#19 )
  2. Refactored smoke tests to support shared HTML specs
  3. Updated nyc.config.js includes / excludes to cover more code

Current Status

=============================== Coverage summary ===============================
Statements   : 83.13% ( 1409/1695 )
Branches     : 75.35% ( 584/775 )
Functions    : 84.75% ( 289/341 )
Lines        : 83.09% ( 1400/1685 )
================================================================================

TODO

  1. Fix error handling specs failure in Windows (gallinago related issue?) - stderr is not piping back out to the parent process on Windows thescientist13/gallinago#22
  2. Finish develop command tests
    • dev proxy
    • source maps
    • image
    • font
    • 404
    • JSON
  3. Finish server command tests - will defer to another PR, see Chore/issue 47 test coverage develop and serve commands #670 (comment)
    • mpa router
    • spa router
  4. Add GraphQL server specs
  5. Add supplemental plugin develop specs
    • .gql
    • typescript
    • import JSON
    • import CSS
    • example of using graphql clients (nice to have)
  6. better way around setTimeout and long timeout?
  7. Add a coverage badge to README?

Discussion

Try and bump all thresholds to at least 85% / or clear out all red spots? Should try and assess what's left and make another pass at this issue in a future project, since there is a lot of good work here already.

@thescientist13 thescientist13 added the chore unit testing, maintenance, etc label Jul 21, 2021
@thescientist13 thescientist13 self-assigned this Jul 21, 2021
@thescientist13
Copy link
Member Author

thescientist13 commented Jul 22, 2021

Interesting, looks like from the repo, even things we've added decent coverage for like dev proxy and node module resolve still don't seem to push our thresholds up further even with more and more specs added. Wonder if the issue is because we are not explicitly using these plugins in our code, just dynamically loading them in a glob / loop, and thus coverage can't map usage to class name? 🤔
Screen Shot 2021-07-22 at 12 25 34 PM
Screen Shot 2021-07-22 at 12 21 59 PM
Screen Shot 2021-07-22 at 12 21 22 PM
Screen Shot 2021-07-22 at 12 28 19 PM

Will keep plugging away since its great to have this stuff tested. 🏆

Maybe see if anything changes after merging #665 ?

@thescientist13 thescientist13 added the discussion tied to an ongoing discussion or meeting notes label Jul 22, 2021
@thescientist13
Copy link
Member Author

Will need to move more of the serve testing for MPA and SPA modes to another PR since they will require client side interaction with puppeteer, which I was able to get mostly working, it's just although I could see the console logging for done(), the tests hung and never finishing and the terminal just hangs.

This is what, since i was trying to see if I could do it all sync since I was also getting mocha errors complaining about using done() with async it blocks

it('should initiate MPA routing', function(done) {
  puppeteer.launch({
    headless: true,
    args: ['--no-sandbox']
  }).then((browser) => {
    browser
      .newPage().then((page) => {
        page
          .goto(`${hostname}/`, {
            waitUntil: 'networkidle0',
            timeout: 0
          }).then((response) => {
            console.debug('loaded home page', response);
            page
              .content().then((contents) => {
                console.debug('home page response', contents);
                page.close().then(() => {
                  console.debug('all done????');
                  done();
                });
              });
          });
      });
  });
});

@thescientist13 thescientist13 marked this pull request as ready for review July 23, 2021 21:49
@thescientist13
Copy link
Member Author

Also tracking this as a follow up - #47 (comment)

@thescientist13 thescientist13 force-pushed the chore/issue-47-test-coverage-develop-and-serve-commands branch from 3609774 to 65dac0d Compare July 29, 2021 21:46
@thescientist13 thescientist13 merged commit 61a64c8 into master Jul 29, 2021
@thescientist13 thescientist13 deleted the chore/issue-47-test-coverage-develop-and-serve-commands branch July 29, 2021 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore unit testing, maintenance, etc discussion tied to an ongoing discussion or meeting notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add tests for develop and serve commands
1 participant