Nexmo / nexmo-cli

Nexmo CLI (Command Line Interface)
https://nexmo.com
MIT License
78 stars 52 forks source link

Fixing the Build Failure for Coverage #231

Closed lornajane closed 3 years ago

lornajane commented 3 years ago

Summary

We have build failures on the master branch where even though a PR built successfully, npm run coverage fails. I can also replicate this locally.

So far, this PR includes an update to caniuse-lite since that also outputs errors, but that didn't fix the overall coverage problem.

lornajane commented 3 years ago

Output of the npm run coverage command, run locally

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nexmo-cli@0.3.15 coverage: `cross-env NODE_ENV=test nyc --reporter=text-lcov mocha --require @babel/register tests/* > coverage.lcov`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the nexmo-cli@0.3.15 coverage script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/lorna/.npm/_logs/2020-10-29T09_34_33_273Z-debug.log
lornajane commented 3 years ago

Interesting that the pull request build now fails as well! So at least we can see that we haven't fixed the bug.

lornajane commented 3 years ago

@kellyjandrews one for you to look at I think

kellyjandrews commented 3 years ago

Thanks @lornajane - I'll take a look and see what I can figure out here.

kellyjandrews commented 3 years ago

The build error occurs because there are two failing tests. Once those are fixed, builds should return to normal.

lornajane commented 3 years ago

@kellyjandrews can you help me follow your thought process here please? I am looking at https://travis-ci.org/github/Nexmo/nexmo-cli/jobs/739864656 which shows the coverage failed, as the reason for the build failure.

Since you mentioned the tests, I notice that npm run test run locally does also fail for two tests. However the pull request that brought in those changes did not have a failing build.

Can you help me understand how the failing tests (that I do not see in the output of the build) relate to the coverage errors I see here? Are we running the tests on build?

kellyjandrews commented 3 years ago

@lornajane It appears that we only run npm run coverage in travis, and not npm test. However, the coverage task runs the test and fails if the unit tests fail. I do not, however, quite yet understand why they passed on the PR, but not here.

kellyjandrews commented 3 years ago

Pushed a small fix to the tests - I honestly don't know why they worked before, and not now. The spacing adjustment seemed to resolve the problem.

kellyjandrews commented 3 years ago

Found it - the original PR compared to the master branch - https://github.com/sudiptog81/nexmo-cli/compare/dev-01-10-2020...Nexmo:master#diff-bd46c5424231724f4d86958f62115c3e8973054d4101ea61136ec2d16e30a68eL31-L32

At one point there was a new line after the log, that was removed, but the tests were not updated to match.

lornajane commented 3 years ago

Ohhhh, that might have been me, I fiddled with the output formatting