I don't understand how it is possible to test a package that is debugOnly.
My package.js
is quite simple :
Package.describe({
name: 'lambda',
version: '0.0.1',
debugOnly: true // Will not be packaged into the production build
});
Package.onUse(function(api) {
api.versionsFrom('1.2.1');
api.addFiles('lambda.js');
api.export("Lambda", 'server');
});
Package.onTest(function(api) {
api.use('tinytest');
api.use('lambda');
api.addFiles('lambda-tests.js', 'server');
});
My lambda-test.js
:
Tinytest.add('example', function (test) {
test.equal(Lambda.func(), true);
});
My lambda.js
:
Lambda = {
func: function() {
return "Christmas";
}
}
When I run meteor test-packages
, it just fails : Lambda is not defined. If I remove the debugOnly: true
the test pass. So how can I test my package using tinytest ?
Or this is a bug !
I had the same issue! It turns out the tests are working fine. The Lambda is not getting exported in the project either.
from https://github.com/meteor/meteor/blob/0f0c5d3bb3a5492254cd0843339a6716ef65fce1/tools/isobuild/compiler.js
Try:
Now you can do something like this: