Has anyone been able to run a suite of tests that doesn’t require Meteor to be built and running?
I’d like to drastically speed up test writing, especially since a lot of tests don’t require Meteor to be running, yet I still have to wait for the whole app to rebuild every time I make a change.
Ideally there’d be some way of figuring out whether any meteor-related dependency has been imported and don’t run those tests. Wondering if anyone has tried something similar to this?
I’ve taken the time to isolate a lot of my business logic into modules that don’t require any Meteor dependencies.
When they need to write to a database I pass in a Repository object that I can easily mock out during tests.
Yeah I use Jest to run unit tests outside Meteor. There’s an option to instruct Jest where to find modules, I use it like this
The first one maps imports from
meteor/x to a file in
tests/meteor-mocks with the same name. So importing
Second one makes sure that absolute path imports (
/src/imports/foo) work correctly
Ah, that’s great advice!
I ended up purchasing a copy of wallabyJS and following some of the great (though sometimes slightly dated) tips on the forums at these links:
dev branch of this repo: