mardi 8 décembre 2015

How to test a server side debugOnly package

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 !

Aucun commentaire:

Enregistrer un commentaire