postman-runtime
postman-runtime copied to clipboard
Remove bail out behavior if one of the entrypoints does not exist
If one of the provided entry points is invalid(probably it does exist), then we SHOULDN'T bail out.
Why? Because this is completely surprising behavior for API.
If I have a list of valid entry points(at least I think so, in reality just one of them can be invalid. Mb typo or anything else, whatever). Then I try to run them, I'll get nothing in result. Exactly nothing. Not the error, just success saying nothing was run.
What am I supposed to think of? I see my correct entry points and they're not run. This is so confusing.
The predictable behavior in that case would be throw an error, saying one of your entry points does not exist. Or just ignore the invalid entry points. The correct choice depends on the executed operation. If it's Get(means result should be returned), then error is more natural. If it's Find(like searching for something), then ignoring of non-existent entry points is totally fine.
Since in our case we got a look up(lookupByMultipleIdOrName), then ignoring is our choice.
Btw making some warning about the invalid entry points would be great, do we have a logger or anything like this?
Codecov Report
Merging #1165 (dd22b7d) into develop (09e11bc) will not change coverage. The diff coverage is
100.00%.
@@ Coverage Diff @@
## develop #1165 +/- ##
========================================
Coverage 91.05% 91.05%
========================================
Files 42 42
Lines 2593 2593
Branches 752 752
========================================
Hits 2361 2361
Misses 232 232
| Flag | Coverage Δ | |
|---|---|---|
| integration | 79.52% <0.00%> (ø) |
|
| legacy | 55.61% <0.00%> (ø) |
|
| unit | 49.59% <100.00%> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| lib/runner/extract-runnable-items.js | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 09e11bc...dd22b7d. Read the comment docs.
Agree that this is an unexpected behavior but I would rather like to bail out early with an error than executing an invalid (with missing items) run.
@codenirvana , I'm totally fine to throw an error. Thank you for response 🙏🏼 I ll modify the code right in the current PR.
@ceoro9 Actually, there's an abortOnError runner option (refer to this test) which you can set to make sure the run terminates with an error.
@codenirvana , cool. I ll use it. Thank you. Any other comments on code?