Dev dependencies in Meteor packages

Hello guys,

I’m trying to add jest as a dev dependency to an atmosphere package I’m developing in order to test it, and i’m wondering how to add it without it being bundled with the whole package in production.

Is there any way to achieve that similar to Npm.depends but not adding it to the whole build ?

Thanks for your answer,

You can just add it to your package.json as you would any other project and then run npm install

npm install --save-dev package : Package will appear in your devDependencies and won’t get added in production.

1 Like

Are you sure this is working in the context of meteor create --package ?

There is no package.json in my working environment right now and I can only specify Npm.depends in package.js which adds the package to the production bundle.

I know I can test the package from my application directly with your command but can I test my package in its own environment with jest and publish it on atmosphere without it ?

I’d like to do so in a natural meteor process as it’s supposed to fully support npm.

How can I add a dev dependency for my atmosphere package directly from the package.js file ? Is it even possible ?

Ideally, in Package.onTest() would be perfect but I can’t manage to make it work :confused:

Thanks for your answers,

Oops - I missed the point about it being a Meteor package.

How is it not working? That part of the package.js is used when you use the meteor test-packages command. In the past I’ve used this successfully with tinytest, but the pronciple should be the same for any other test package.

Well, the thing is jest is an npm package, not an atmosphere package like tinytest or practicalmeteor:mocha.

I can of course do Npm.depends({jest: "23.6.0"}) in the package.js but this still leave the test package part of the bundle when I publish it, which doesn’t make sense considering this should only be needed on test.

Btw, using meteor test-packages only work with a test driver being part of an atmosphere package referenced as a dependency, right ?