levino/mock-jwks

nock peerDependency

akmjenkins opened this issue · 1 comments

I accidentally removed nock and broke my jwk tests which got me thinking - why is nock a peerDependency and not a dependency? This package absolutely depends on nock, but the user doesn't actually need to be using nock anywhere in their own code to want to use this package.

Thanks for the super great library! Life saver!

The problem is a potential nock version mismatch. If the user has nock installed as an own dependency to their project, my package would also include nock but potentially in a different version. Loading two different versions of nock at the same time will lead to very unexpected and hard to debug behavior (trust me, I have been there, things will fail and you will not know why). During the installation of mock-jwks you will get a warning about missing peer dependencies. These warnings should not be ignored but adressed. Please reopen if you have further questions.