2015-09-14 48 views
2

我有使用测试流星JS /摩卡与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:[email protected]','velocity:[email protected]]); 

    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?


UPDATE:

发现了DEBUG = 1个标志之后...我在两个开发和wercker.yml

ON DEV运行

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

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 

and 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 
+0

也许这将帮助:http://blog.wercker.com/2013/07/19/Continuous-Delivery-for-Meteor-apps html的 – Tal

回答

1

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

1

我还没有完全想到用Mocha的实现,但我发现使用'TinyTest'的实现。因为我认为这对其他用户会很有用,所以我已经将少数CI提供商(CircleCI,Travis和Wercker)的流星放在一起。

当然,你需要安装NodeJS。这种变化通过CI供应商,但在特拉维斯CI的情况下,你会想这样的配置:

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

然后,假设你正在构建一个流星包,你会有效地做好以下步骤任何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