2

I've got an app I can test locally without issue using

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

Each package.js in the app I'm testing has the following :

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

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

Now I'm trying to do the same via the Wercker pipeline using the following wercker.yml :

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

The meteor install step works fine but then the pipeline just hangs here :

[[[[[ Tests ]]]]]                             

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

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

Any ideas ? Am I not installing phantomjs correctly ?


UPDATE :

after discovering the DEBUG=1 flags... i run

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

on both dev and in 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

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
Petrov
  • 4,200
  • 6
  • 40
  • 61
  • maybe this will help: http://blog.wercker.com/2013/07/19/Continuous-Delivery-for-Meteor-apps.html – Tal Sep 21 '15 at 07:16

2 Answers2

1

Try to add --once flag into you testing command.

Crisboot
  • 1,420
  • 2
  • 18
  • 29
1

I haven't quite figured out the implementation with Mocha, but I have found the implementation using 'TinyTest'. Since I thought this would be useful for other users, I've put together a minimal example of Meteor with a few CI providers (CircleCI, Travis, and Wercker).

Of course, you'll need NodeJS installed. This varies by CI provider, but in the case of Travis CI, you'll want a configuration like this :

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

Then, assuming you're building a Meteor package, you'll effectively do the following steps in any CI environment :

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

Source Code is available: https://github.com/b-long/meteor-ci-example

blong
  • 2,815
  • 8
  • 44
  • 110