'Transitive npm devDependencies

We know how the dependencies work in NPM. My question is, how can I create a common-library that provides dev dependencies to multiple other components?

Let's say I have a microservice architecture where all the components use mocha and nyc for running the tests.

I don't want to go into each separate component to add them, but to manage this "testing framework" from one central library in devDependencies - however since they are not transitive, they are not installed. I cannot also put them in dependencies because they are not relevant in production mode...

Is it possible in NPM?



Solution 1:[1]

I've Searched for the same but sadly, the response is :
no, this isn't possible in NPM.

Workaround

Adding them directly inside the peerDependencies list and counting on the three shaking to make it work.

Feature-request

https://github.com/npm/rfcs/issues/553

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1