Writing tests for meteor applications

Ah, our latest pain point. Be prepared for a lot of pain if you want to add proper testing to Meteor (see our recent questions on Mocking/Stubbing/Spy Mocking ES6 module dependencies).

The strategy setup in the Meteor guide is more theoretical and will only work for integration tests (meaning that your function that you test isn’t calling any other function). As soon as you have to stub or mock something, you will find out that it’s not working (well, as of end of last week we finally have a working solution Using sinon.spy to track callCount always returns 0 on nested functions).

But for integration tests on the backend (most examples you find will be for frontend where also Meteor seems to focus on) it’s difficult. Loading of a database is difficult (needs to be in a special format to load a MongoDb which is then artificially increased in size a couple of times).

We haven’t started with any E2E test involving both front- and backend.

We’ve tried any tool on the planet, we’d love to get Wallaby going (again, see our threats on that topic Wallaby.js on 1.8 Broken) but it ended up with Meteor saying Wallaby should invest time and Wallaby saying they have no specific Meteor knowledge so MDG should invest time. Guess what, we can’t use it though if it would be working it would be a great step forward.

In summary, proper testing isn’t possible with Meteor IMO. Again, to me that’s a turnoff point for any serious small business out there.

Those open pain points should be addressed with top priority IMO as testing is a basic requirement for any serious app that is used in production (like as MongoDb multi-document transactions, see https://forums.meteor.com/t/has-anyone-got-multi-document-acid-transactions-to-work-in-meteor/47427).

But it’s obviously MDG’s decision where they put the resources. But the current way where they concentrate their time & resources on isn’t helping attracting and more important, retaining business customer (and when I say business customer I don’t mean AirBnb who can easily throw some 20 developers at something that isn’t working and develop their own solution)!

1 Like