Hi Meteor folks,
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?
- Any other paths that I should consider?
Thanks in advance for you wisdom!