Meteor Tinytest packages dependencies

106 Views Asked by At

I like to test my code. I like to compartmentalize my code into packages. And I like Meteor. Now I'm trying Meteor Tinytest meteor test-packages, but I'm getting some weirdness. For example:

TypeError: Cannot read property 'Email' of undefined

Because of SimpleSchema.RegEx.Email. But this code works when it's not tested. Also, SimpleSchema is an object at this point (checked through console.log), and SimpleSchema.RegEx is undefined indeed, but this is completely not what I expected.

Adding api.use('aldeed:simple-schema', ['server']); to the onTest section of package.js doesn't do anything, which is kind of expected. But I'm not sure what I am to do to fix this issue.

1

There are 1 best solutions below

0
On

Apparently there's a bug: Package.js api.use() loads very old versions, which (mostly) doesn't matter for your application but it matters a lot when you're testing packages individually.

to be updated