Closed rodion-arr closed 4 years ago
@ljharb The first idea was to invoke bin with 'exec' like it was implemented in 'support' but in this case I don't see possibilities to inject mocks
What mocks are needed? Could we use something like nock
to handle it?
General idea was to check that relevant function was called without really invoking it and do real requests to GitHub API while just checking that all passed to CLI options are correct.
it seems like we should be able to mock out the network requests with something like nock or vcr, and then exec the binary directly?
I got the point, I'll rollback the bin changes and try another approach. Thanks for suggestions 🤝
@ljharb, I tried nock
and it is not working with child processes (https://github.com/nock/nock/issues/990)
Could you please send a link for what you called vcr
, so I can try those one?
I'm going to play with this package but it seems not very fresh - https://www.npmjs.com/package/node-vcr
ah, vcr is a rails thing, and i think nock is what i had in mind. however, you can pass nock env vars into NODE_OPTIONS, which the child process's node
should respect, including --require
?
Thanks, will try
@dominykas could you please rerun tests? It was failed due to rate limits
:tada: This PR is included in version 0.1.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
- bin script refactored to be able to run cli and get output from tests- calls to actual commands logic are mocked (only commands and options interfaces are under test)- addsinon
as mocking libUpdate after suggestions below:
nock
for mocking http requestsexec
nock
configuration is passing into child process viaNODE_OPTIONS
env +--require
flagCloses #26