Blaze not available in Tinytest?


#1

I think I’m suffering from some kind of conceptual misunderstanding here. I’d like to unit test a global Blaze helper, so I thought I could get it like this:

Blaze._globalHelpers["myHelper](...)

But I can’t get Blaze in my scope – even though I’ve added it to the list of used dependencies on the client.

The only way I’ve found to access it is through Package.blaze.Blaze.

What gives?


#2

You need to add api.use('templating', 'client'); to the Package.onTest section of your package.js.


#3

Yep, or api.use("blaze").


#4

Blaze has become available after I’ve removed this line* from inside onTest:

// Resulted in Blaze not being present in client code
api.use("blaze-html-templates");

* I decided that I didn’t need templates for the tests