0

现在我有:

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');
});

MochaWeb?.testOnly ->
  describe 'sanity', ->
    it 'is visible', ->
      chai.assert.isDefined SynapsePay

https://github.com/parlaywithme/meteor-synapsepay

我遇到has no method 'testOnly'错误,正在运行

meteor test-packages ./

里面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
4

1 回答 1

2

虽然目前记录不佳,但这个问题可以很容易地解决:
只需放弃testOnly并直接在测试文件中编写测试。

describe 'sanity', ->
  it 'is visible', ->
    chai.assert.isDefined SynapsePay

Mocha 最初是为应用程序测试而设计的。将其用于包测试可能具有挑战性。
当您运行测试时,您可能还会在控制台中看到大Meteor.methods的匹配错误。这是一个不应该干扰测试本身的常见问题。

于 2015-10-18T13:58:46.487 回答