Using external packages during tests

Case is that. I have package A and package B. Package A provides helpers to Meteor.users collection using dburles:collection-helpers. Now, package B uses those helpers and everything works but … during tests i have user.myHelperFuntion is not a function when running :

meteor test-packages --driver-package dispatch:mocha --settings ../config/dev/test_settings.json --once

Of course in package B i have Package.onTest( function(api){ api.use('packageA')} );

Any idea how could i make it working?
Thx in advance

Edit: i missed that on top of everything i see :

ReferenceError: _ is not defined    at Collection.Meteor.users.helpers (packages/dburles_collection-helpers.js:55:5)

so problem is in collection-helpers package.

Hi Schapiro,

i don’t have the same issue as I’m running a pimped version of nested-collection-helpers myself… (

Seems like the package author didn’t think to make “underscore” a dependency in the packages’ package.js.

Maybe you can clone the package to your local packages - directory and add this to the package.js - file:

Package.onUse(function(api) {

…or just use the package stfnbrgh:nested-collection-helpers (, which should do about the same with a little bit more to boot.

The thing is, for a long time underscore and the global _ - Object was a given in all Meteor Code, so that maybe the package didn’t include it when it was written in ye olden days.

Nowadays underscore isn’t automatically loaded everywhere and that’s probably why the package breaks.

Have a nice day! :slight_smile:

1 Like

thx a lot. Have a pretty day Daniel :slight_smile: