Meteor 1.3 unit testing and meteor module imports

Hi, thanks to Mantra, unit testing of the clinet code is a breeze. Yet, I have a bit of issue with understanding how can I do server unit tests with meteor imports.

Server files tend to have imports such as

import { Meteor } from “meteor/meteor”;

Since these packages do not exists per se, the unit test does not recognise them. How can I deal with these package imports in my mocha tests? Thanks!

There is a “meteor-node-stubs” package, yet it has no documentation and I’m not even sure if it is aimed to do this job. Thanks!

1 Like

I have the same issue. Client side works great as all dependencies are in Mantra’s context and can be easily mocked. I have a number of server side service classes I need to test but understandably the imports fail.

This thread covers a potential solution using proxyquire which I’m going to investigate now.