Closed dimitrisnl closed 4 years ago
@LucianBuzzo Can you advise an action for testing this? We have e2e tests in place, but I believe we might have to reconsider how we do plugin testing.
@dimitrisnl You could use proxyquire or dependency injection to stub npm-api
which should get you into a good position.
I'm sorry, so we have some e2e tests that run the plugin against the actual NPM API. Why would we want to stub the NPM call?
I might be confusing things here, but this would make sense if I extract the NPM functionality as a separate utility.
@LucianBuzzo
@dimitrisnl If you already have e2e tests, then add unit tests specifically for this plugin
So, to make sure I got it right,
Great, thanks
@dimitrisnl Yep, Thats the technical approach.
I would spend some time thinking about what the expected behaviour of this plugin and writing the behaviour down as statements.
Once you have your list of statements, you can then write tests that assert that the statements are correct.
You can also look at the nyc
output after a test run to see what lines of code you aren't covering in your tests
Connects-to: #67 Change-type: minor Signed-off-by: Dimitrios Lytras dimitrios@balena.io