Npm.depends in Package.onTest

Is it possible to have an Npm.depends that is used only in test mode? My use case is I have a package (that has other npm dependencies) that needs to use other npm modules when testing. More specifically, the package contains React components so it needs react when testing, but I don’t want to include react as a top level dependency as that would fix the version number.

I tried putting the Npm.depends under both Package.onUse and Package.onTest but that caused an infinite loop.

Nvm I got it to work by listing the (main) npm dependencies both under Package.onTest and Package.onUse :slight_smile:

1 Like

@nicocrm Hey, I ran into the same problem you did, and tried your suggestion, but it didn’t work. Do you think you’ll be able to help me out? I have my question laid out here. Thanks!

I am not sure it’s really the same scenario, but in case it helps this is the package.js file I used. There is one package in the onTest that is not used in the production version (react-addons-test-utils), but that does not cause any sort of conflict since the package is not indirectly required in production either.