I´ve written a module containing business logic, that I would like to test.
With module, I mean code that fits in one js file, and it only adds one symbol to the global namespace. The module´s interaction with Meteor can be easily mocked.
I´ve tried Velocity but it is not of my taste:
not all changes are recongnized.
it takes from ten seconds upwards to before I see results.
the stack trace shown is not relevant to me.
I love the debugger and I´m unsure how to do it.
As Velocity uses mocha, and I wanted to keep the amount of frameworks to a minumun, I choose to use mocha (standalone) for testing this module.
My question now is how do I get access to my module from within a mocha standalone test?
I understand that I need to “import” the module somehow into my test.
The traditional node way would be to use CommonJS and require my module.
Meteor loads js files in some other way. Maybe it would be smarter to use the same mechanism Meteor is using to load my code, rather than using CommonJS?
How does meteor loads the js files?
Can I access the code loading infrastructure from Meteor?
I just finished working my way through the labyrinth of Velocity testing a Meteor packaged jQuery plugin and posted a deliberately trivial demo of it on GitHub and AtmosphereJS.
@warehouseman: No I did not mean a Meteor package when I say module. I just mean a small piece of my code that I want to test. Not big enough to be a standalone package.
I fixed the problem with my demo, (inadvertently deleted file), please try again.
I found it frustrating that the Velocity demos seemed to shy away from clarifying how to interact with different parts of Meteor. I suspect you have found the same, but I am unclear what exactly is giving you difficulty.