Differences between Meteor 1.3 and Mantra's testing approach?

Mantra is using several tools -chai, enzyme, sinon, gagarin, etc- to perform tests. Does anybody know if Mantra’s approach for testing will differ a lot from Meteor 1.3 guide for testing?

They should be generally compatible. It appears that Meteor is getting low-level device-driver support for flavors of Mocha for use in unit testing. So anything that’s compatible with Mocha will probably be compatible with Meteor 1.3… chai, sinon, gagarin, chimp, nightwatch. Probably all supported to some extent.

The bigger question is whether your app code has been migrated to use imports/exports and pure functions. As I understand things, there will be 1.3 testing features that rely on import/exports and pure functions. So while chai can be sprinkled most anywhere, and gagarin can access global objects, real-time code analysis won’t work unless using pure functions.

1 Like

Mantra is Arunoda’s way of testing Meteor apps. It works. As far as I can tell, Mantra focuses only on client-side unit tests. The tool choices are pretty good, I really like Enzyme for react testing and that’s an add-on that you can use in your project.

If you look at how Avital is unit testing the todo’s app, you’ll notice he has server tests.

Also, Meteor 1.3 sprinkles tests within the app by using *.tests.js which is very nice as it means you can keep your test files right next to your code files, and since you’re using modules, you don’t have to care about the files being included in your app.

Are you trying to get started with some testing now and trying to keep yourself near-future proof? If so, then focus on making your app units small, decoupled and testable, and any migration will be relatively painless.

1 Like

Okay let me answer this. With Mantra, we could isolate whole meteor stuff into a single file, which is the app context.

Then all the other stuff are pure Node and NPM stuffs. So, testing also follows the same.

We use standard Node, NPM stuff and we don’t need any help from the Meteor tool.

Anyway, Mantra is a client side architecture

So, we don’t(won’t) have anything for the server. For the server we mostly need integration testing. For now, Gagarin is the best choice. I am waiting to see what’s come with Meteor 1.3.

1 Like