Right now I have:
Package.describe({
name: 'parlay:synapsepay',
version: '0.0.1',
summary: 'synapse_pay_rest for Meteor',
git: 'https://github.com/parlaywithme/meteor-synapsepay',
documentation: 'README.md'
});
Package.onUse(function(api) {
api.versionsFrom('1.2.0.2');
api.use('coffeescript');
api.addFiles('synapsepay.coffee');
});
Package.onTest(function(api) {
api.use('coffeescript');
api.use('mike:mocha-package');
api.use('parlay:synapsepay');
api.addFiles('synapsepay-tests.coffee');
});
and
MochaWeb?.testOnly ->
describe 'sanity', ->
it 'is visible', ->
chai.assert.isDefined SynapsePay
https://github.com/parlaywithme/meteor-synapsepay
I'm getting a has no method 'testOnly'
error, running
meteor test-packages ./
inside packages/meteor-synapsepay
:
ERROR: packages.json parsing error [ ENOENT, no such file or directory '/Users/me/parlay/packages/meteor-synapsepay/packages.json' ]
[[[[[ Tests ]]]]]
=> Started proxy.
=> Started MongoDB.
W20151018-00:24:58.123(-4)? (STDERR)
W20151018-00:24:58.125(-4)? (STDERR) /Users/me/.meteor/packages/meteor-tool/.1.1.9.osr2yb++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151018-00:24:58.125(-4)? (STDERR) throw(ex);
W20151018-00:24:58.125(-4)? (STDERR) ^
W20151018-00:24:58.125(-4)? (STDERR) TypeError: Object [object Object] has no method 'testOnly'
W20151018-00:24:58.125(-4)? (STDERR) at Package (packages/local-test_parlay_synapsepay/synapsepay-tests.coffee:1:11)
W20151018-00:24:58.125(-4)? (STDERR) at packages/local-test_parlay_synapsepay/synapsepay-tests.coffee:1:1
W20151018-00:24:58.126(-4)? (STDERR) at packages/local-test_parlay_synapsepay/synapsepay-tests.coffee:1:1
W20151018-00:24:58.126(-4)? (STDERR) at /private/tmp/meteor-test-run1tbmejw/.meteor/local/build/programs/server/boot.js:242:10
W20151018-00:24:58.126(-4)? (STDERR) at Array.forEach (native)
W20151018-00:24:58.126(-4)? (STDERR) at Function._.each._.forEach (/Users/me/.meteor/packages/meteor-tool/.1.1.9.osr2yb++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20151018-00:24:58.126(-4)? (STDERR) at /private/tmp/meteor-test-run1tbmejw/.meteor/local/build/programs/server/boot.js:137:5
=> Exited with code: 8
While poorly documented at the moment, this issue can be solved easily:
Simply ditch testOnly
and write your tests directly in your test file.
describe 'sanity', ->
it 'is visible', ->
chai.assert.isDefined SynapsePay
Mocha was first designed for application tests. Using it for package tests can prove challenging.
When you will have your tests running, you may also see big Meteor.methods
Match errors in the console. It is a common issue that should not interfere with the tests themselves.