使用wercker管道测试meteor js / mocha会挂起

时间:2015-09-14 14:28:59

标签: meteor mocha meteor-velocity wercker

我有一个应用程序,我可以使用

进行本地测试而不会出现问题
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上的

ON DEV:

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

和ON 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

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

我还没有完全了解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