【问题标题】:Testing meteor js/mocha with wercker pipeline hangs使用 wercker 管道测试流星 js/mocha 挂起
【发布时间】:2015-09-14 14:28:58
【问题描述】:

我有一个应用程序,我可以在本地测试没有问题

meteor test-packages --velocity
// result
[[[[[ Tests ]]]]]                             

=> Started proxy.                             
=> Started MongoDB.                           
=> Started your app.                          

=> App running at: http://localhost:3000/
PASSED mocha : sanjo:jasmine on server => works
TESTS RAN SUCCESSFULLY

我正在测试的应用程序中的每个 package.js 都有以下内容:

Package.onTest(function(api) {
  api.use(['mike:mocha-package@0.5.8','velocity:core@0.9.3]);

  api.addFiles('tests/server/example.js', 'server');
});

现在我正在尝试使用以下 wercker.yml 通过 Wercker 管道做同样的事情:

build :
    box: ubuntu
    steps :

    # have to install meteor to run the tests
    - script :
        name : meteor install
        code : |
            sudo apt-get update -y
            sudo apt-get -y install curl wget
            cd /tmp
            wget https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2
            tar xfj phantomjs-1.9.1-linux-x86_64.tar.bz2
            sudo cp /tmp/phantomjs-1.9.1-linux-x86_64/bin/phantomjs /usr/local/bin
            curl https://install.meteor.com | /bin/sh

    # run tests using meteor test cli
    - script :
        name : meteor test
        code : |
            meteor test-packages --velocity --settings config/settings.json

流星安装步骤工作正常,但管道只是挂在这里:

[[[[[ Tests ]]]]]                             

=> Started proxy.                             
=> Started MongoDB.                           
=> Started your app.                          

=> App running at: http://localhost:3000/

有什么想法吗?我没有正确安装 phantomjs 吗?


更新:

发现 DEBUG=1 标志后...我运行

DEBUG=1 VELOCITY_DEBUG=1 meteor test-packages --velocity

在 dev 和 wercker.yml 中

在开发中:

I20150915-21:12:35.362(2)? [velocity] adding velocity core
I20150915-21:12:36.534(2)? [velocity] Register framework mocha with regex mocha/.+\.(js|coffee|litcoffee|coffee\.md)$
I20150915-21:12:36.782(2)? [velocity] Server startup
I20150915-21:12:36.785(2)? [velocity] app dir /private/var/folders/c3/hlsb9j0s0d3ck8trdcqscpzc0000gn/T/meteor-test-runyaqy6y
I20150915-21:12:36.785(2)? [velocity] config = {
I20150915-21:12:36.785(2)?   "mocha": {
I20150915-21:12:36.785(2)?     "regex": "mocha/.+\\.(js|coffee|litcoffee|coffee\\.md)$",
I20150915-21:12:36.785(2)?     "name": "mocha",
I20150915-21:12:36.785(2)?     "_regexp": {}
I20150915-21:12:36.785(2)?   }
I20150915-21:12:36.785(2)? }
I20150915-21:12:36.787(2)? [velocity] resetting the world
I20150915-21:12:36.787(2)? [velocity] frameworks with disable auto reset: []
I20150915-21:12:36.797(2)? [velocity] Add paths to watcher [ '/private/var/folders/c3/hlsb9j0s0d3ck8trdcqscpzc0000gn/T/meteor-test-runyaqy6y/tests' ]
I20150915-21:12:36.811(2)? [velocity] File scan complete, now watching /tests
I20150915-21:12:36.811(2)? [velocity] Triggering queued startup functions
=> Started your app.

=> App running at: http://localhost:3000/
PASSED mocha : sanjo:jasmine on server => works
TESTS RAN SUCCESSFULLY

在 WERCKER 上:

[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.
I20150915-19:03:24.207(0)? [velocity] adding velocity core
I20150915-19:03:24.299(0)? [velocity] Register framework mocha with regex mocha/.+\.(js|coffee|litcoffee|coffee\.md)$
I20150915-19:03:24.342(0)? [velocity] Server startup
I20150915-19:03:24.343(0)? [velocity] app dir /tmp/meteor-test-run1f61jb9
I20150915-19:03:24.343(0)? [velocity] config = {
I20150915-19:03:24.343(0)?   "mocha": {
I20150915-19:03:24.344(0)?     "regex": "mocha/.+\\.(js|coffee|litcoffee|coffee\\.md)$",
I20150915-19:03:24.344(0)?     "name": "mocha",
I20150915-19:03:24.344(0)?     "_regexp": {}
I20150915-19:03:24.344(0)?   }
I20150915-19:03:24.344(0)? }
I20150915-19:03:24.346(0)? [velocity] resetting the world
I20150915-19:03:24.347(0)? [velocity] frameworks with disable auto reset: []
I20150915-19:03:24.354(0)? [velocity] Add paths to watcher [ '/tmp/meteor-test-run1f61jb9/tests' ]
=> Started your app.

=> App running at: http://localhost:3000/
I20150915-19:03:24.378(0)? [velocity] File scan complete, now watching /tests
I20150915-19:03:24.378(0)? [velocity] Triggering queued startup functions

【问题讨论】:

标签: meteor mocha.js meteor-velocity wercker


【解决方案1】:

尝试在您的测试命令中添加--once 标志。

【讨论】:

    【解决方案2】:

    我还没有完全弄清楚 Mocha 的实现,但我找到了使用“TinyTest”的实现。因为我认为这对其他用户有用,所以我将 Meteor 的最小示例与一些 CI 提供者(CircleCI、Travis 和 Wercker)放在一起。

    当然,您需要安装 NodeJS。这因 CI 提供商而异,但对于 Travis CI,您需要这样的配置:

    sudo: required
    language: node_js
    node_js:
      - "0.10"
      - "0.12"
      - "4.0"
    

    然后,假设您正在构建 Meteor 包,您将在任何 CI 环境中有效地执行以下步骤:

    # Install Meteor
    meteor || curl https://install.meteor.com | /bin/sh
    # Install spacejam
    npm install -g spacejam
    # Execute your tests
    spacejam test-packages ./
    

    源代码可用:https://github.com/b-long/meteor-ci-example

    【讨论】:

      猜你喜欢
      • 2017-03-28
      • 2018-12-05
      • 2017-05-10
      • 1970-01-01
      • 2016-03-09
      • 2019-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多