I’ve been doing a similar thing recently in 1.2 for testing individual coffeescript ‘classes’ with Jasmine. This also lets you have fast running tests that don’t require Meteor to be running:
@MyClass = class MyClass
# blah blah blah...
# module is undefined in Meteor so this will be skipped except for when we're running
# tests from the command line with jasmine. Install with: npm install -g jasmine
module?.exports = MyClass
Now in my jasmine tests I can just* do:
MyClass = require('./../blah/myclass')
describe 'sometest', ->
it 'does something', ->
myClass = new MyClass
But as @johanbrook says, because of all the Meteor globals any older code is going to have to be refactored to use some form of DI so we can create mocks.
(*some setup required to get jasmine to run coffeescript tests)