【问题标题】:Error after install mocha in meteor在流星中安装摩卡后出错
【发布时间】:2018-05-13 11:42:24
【问题描述】:

我想对我的软件做一些测试,所以我在网上找了一些教程,找到了practicemeteor:mocha包。但是在安装包并打开本地之后(无需编写任何测试)。我收到错误提示:

socket-stream-client.js:100 Uncaught TypeError: _this._launchConnection is not a function
    at new ClientStream (socket-stream-client.js:100)
    at new Connection (ddp-client.js:435)
    at Object.DDP.connect (ddp-client.js:2340)
    at client_convenience.js (ddp-client.js:125)
    at fileEvaluate (modules-runtime.js:353)
    at require (modules-runtime.js:248)
    at client.js (ddp-client.js:54)
    at fileEvaluate (modules-runtime.js:353)
    at require (modules-runtime.js:248)
    at ddp-client.js:2381
ddp.js:14 Uncaught TypeError: Cannot read property 'DDP' of undefined
    at ddp.js:14
    at ddp.js:23
allow-deny.js:22 Uncaught TypeError: Cannot read property 'DDP' of undefined
    at allow-deny.js:22
    at allow-deny.js:566
mongo.js:17 Uncaught TypeError: Cannot read property 'AllowDeny' of undefined
    at mongo.js:17
    at mongo.js:871
accounts-base.js:23 Uncaught TypeError: Cannot read property 'DDP' of undefined
    at accounts-base.js:23
    at accounts-base.js:1462
service-configuration.js:17 Uncaught TypeError: Cannot read property 'Accounts' of undefined
    at service-configuration.js:17
    at service-configuration.js:73
accounts-password.js:17 Uncaught TypeError: Cannot read property 'Accounts' of undefined
    at accounts-password.js:17
    at accounts-password.js:329
accounts-ui-unstyled.js:19 Uncaught TypeError: Cannot read property 'ServiceConfiguration' of undefined
    at accounts-ui-unstyled.js:19
    at accounts-ui-unstyled.js:2113
meteortoys_toykit.js:26 Uncaught TypeError: Cannot read property 'Mongo' of undefined
    at meteortoys_toykit.js:26
    at meteortoys_toykit.js:410
msavin_mongol.js:20 Uncaught TypeError: Cannot read property 'Mongo' of undefined
    at msavin_mongol.js:20
    at msavin_mongol.js:1058
autoupdate.js:20 Uncaught TypeError: Cannot read property 'DDP' of undefined
    at autoupdate.js:20
    at autoupdate.js:231
practicalmeteor_mocha.js:18 Uncaught TypeError: Cannot read property 'DDP' of undefined
    at practicalmeteor_mocha.js:18
    at practicalmeteor_mocha.js:13186
livedata.js:14 Uncaught TypeError: Cannot read property 'DDP' of undefined
    at livedata.js:14
    at livedata.js:27
global-imports.js:3 Uncaught TypeError: Cannot read property 'Mongo' of undefined
    at global-imports.js:3
meteor.js:1081 Uncaught Error: Can't find test driver package: practicalmeteor:mocha
    at meteor.js:1081
    at maybeReady (meteor.js:871)
    at HTMLDocument.loadingCompleted (meteor.js:883)

我正在使用流星 1.6.1.1

【问题讨论】:

  • 你用的是哪个mocha驱动包?
  • 我用的是最新版的practicemeteor:mocha!

标签: meteor package mocha.js


【解决方案1】:

我将把它作为答案,因为它可能仍然是相关的,所以来到同一点的新用户。

practialmeteor:mocha 是推荐的软件包,但不再与 Meteor >=1.6.1 兼容,并且不再维护它的可能性非常高(您可以在他们的 open gh issues 中看到)。

替代包包括

  • cultofcoders:mocha

  • meteortesting:mocha

【讨论】:

    【解决方案2】:

    我也遇到过这样的事情,所以我确实花了一些时间才弄清楚。

    根据 Meteor Todo App with Angular 教程,推荐使用 practicalmeteor:mocha 包。有趣的是meteortesting:mocha被用在一个典型的scaffold项目中。

      "scripts": {
        "start": "meteor run",
        "test": "meteor test --once --driver-package meteortesting:mocha",
        "test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
        "visualize": "meteor --production --extra-packages bundle-visualizer"
      },
    

    但是,只有使用从 practicalmeteor:mocha 派生的 cultofcoders:mocha 才有效。

    meteor remove practicalmeteor:mocha
    meteor add cultofcoders:mocha
    meteor test --driver-package cultofcoders:mocha
    

    享受编码!

    【讨论】:

      猜你喜欢
      • 2016-12-03
      • 1970-01-01
      • 2014-01-13
      • 1970-01-01
      • 2014-09-30
      • 2015-04-24
      • 2017-10-01
      • 1970-01-01
      • 2015-01-26
      相关资源
      最近更新 更多