jeudi 2 juin 2016

Why do I have to duplicate packages that I specified in Package.onUse in Package.onTest in Meteor?

On the following command, I get the following error

$ meteor test-packages --driver-package practicalmeteor:mocha rocketchat:spotify

Console output

=> Errors prevented startup:

   While building package local-test:rocketchat:spotify:
   error: No plugin known to handle file 'spotify.test.coffee'. If you want this file to be a static asset, use
   addAssets instead of addFiles; eg, api.addAssets('spotify.test.coffee', 'client').

I'm confused as I have specified the coffeescript package under Package.onUse.

rocketchat-spotify/package.js

Package.describe({
    name: 'rocketchat:spotify',
    version: '0.0.1',
    summary: 'Message pre-processor that will translate spotify on messages',
    git: ''
});

Package.onUse(function(api) {
    api.versionsFrom('1.0');

    api.use([
        'coffeescript', # Coffeescript is included here?
        'templating',
        'underscore',
        'rocketchat:oembed@0.0.1',
        'rocketchat:lib'
    ]);

    api.addFiles('lib/client/widget.coffee', 'client');
    api.addFiles('lib/client/oembedSpotifyWidget.html', 'client');

    api.addFiles('lib/spotify.coffee', ['server', 'client']);
});

Package.onTest(function (api) {
    api.use([
        'rocketchat:spotify'
    ]);
    api.addFiles('spotify.test.coffee');
});

Adding the coffeescript package as follows resolves the issue

Package.onTest(function (api) {
    api.use([
        'coffeescript',
        'rocketchat:spotify'
    ]);
    api.addFiles('spotify.test.coffee');
});

=> Modified -- restarting.
=> Meteor server restarted
=> Started your app.

Console output

=> App running at: http://localhost:3000/
I20160602-17:55:02.867(9)? Updating process.env.MAIL_URL
I20160602-17:55:04.528(9)? MochaRunner.runServerTests: Starting server side tests with run id aXdi2H3kBS8M8Fuhx
W20160602-17:55:04.577(9)? (STDERR) MochaRunner.runServerTests: failures: 10

Version info

$ meteor --version
Meteor 1.2.1

Aucun commentaire:

Enregistrer un commentaire