codecov-node icon indicating copy to clipboard operation
codecov-node copied to clipboard

Add -Z to exit 1

Open stevepeak opened this issue 9 years ago • 5 comments

  • [ ] needs testing

@eddiemoore how do you test process exits?

stevepeak avatar Mar 17 '17 14:03 stevepeak

Codecov Report

Merging #54 into master will decrease coverage by 30.61%. The diff coverage is 45.45%.

@@             Coverage Diff             @@
##           master      #54       +/-   ##
===========================================
- Coverage   95.59%   64.97%   -30.62%     
===========================================
  Files          17       17               
  Lines         227      237       +10     
  Branches       43       46        +3     
===========================================
- Hits          217      154       -63     
- Misses         10       83       +73
Impacted Files Coverage Δ
lib/codecov.js 66.4% <45.45%> (-25.97%) :x:
lib/services/shippable.js 16.66% <0%> (-83.34%) :x:
lib/services/jenkins.js 37.5% <0%> (-62.5%) :x:
lib/services/snap.js 37.5% <0%> (-62.5%) :x:
lib/services/semaphore.js 50% <0%> (-50%) :x:
lib/services/codeship.js 50% <0%> (-50%) :x:
lib/services/gitlab.js 50% <0%> (-50%) :x:
lib/services/wercker.js 50% <0%> (-50%) :x:
lib/services/appveyor.js 50% <0%> (-50%) :x:
lib/services/buildkite.js 50% <0%> (-50%) :x:
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3c8fb1b...c898389. Read the comment docs.

codecov[bot] avatar Mar 17 '17 14:03 codecov[bot]

@stevepeak kind of tricky. Would need to mock the process.exit. Normally it's better to just throw an error which has a similar effect to process.exit, and will stop the code from running after that point. Also makes things easier to test as you don't need to mock anything, just need to check if the function throws the correct error. What do you think?

eddiemoore avatar Mar 19 '17 10:03 eddiemoore

Codecov Report

Merging #54 (a0dafd3) into master (663ffbb) will increase coverage by 4.09%. The diff coverage is 55.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #54      +/-   ##
==========================================
+ Coverage   84.25%   88.34%   +4.09%     
==========================================
  Files          23       24       +1     
  Lines         381      386       +5     
  Branches       95       97       +2     
==========================================
+ Hits          321      341      +20     
+ Misses         49       36      -13     
+ Partials       11        9       -2     
Impacted Files Coverage Δ
lib/codecov.js 78.64% <0.00%> (+7.70%) :arrow_up:
lib/services/teamcity.js 100.00% <100.00%> (ø)
lib/offline.js 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 663ffbb...a0dafd3. Read the comment docs.

codecov[bot] avatar Sep 04 '20 14:09 codecov[bot]

@eddiemoore apologies I don't actually know how to go about testing this either. Any tips here?

thomasrockhu avatar Sep 04 '20 14:09 thomasrockhu

@thomasrockhu what you could do in this case is use something like nock or msw to fake the network request and make it return a failure. Then expect the function to fail with that error message.

eddiemoore avatar Sep 04 '20 18:09 eddiemoore