All Articles

Meteor + Codeship

In my last Article I wrote about acceptance tests in Meteor. We could run those test periodically locally e.g. before every push to VCS. Much better solution is to use some Continuous Integration (CI) server. CI can build our app, install dependencies and run tests after each push to VCS.

My favourite CI server right now is Codeship. They have great UX and offer free plan for Bitbucket. At Codeship you have to set commands which install your app and then run your tests. This is done trough project settings at Codeship website.

Setup commands

This section should install anything which is needed to run your app and tests.

# Install node
nvm install 4.0
# Install npm packages
npm install -g chimp coffee-script spacejam@1.6.2-rc.1

# Install meteor
curl -o
chmod +x
# get sudo for Meteor install script 
sed -i "s/type sudo >\/dev\/null 2>&1/\ false /g"
export PATH=$PATH:~/.meteor/
meteor --version

# Install any other app depenedcies
# clone of your app at this location
cd ~/clone/ && npm install

Test commands

    cd ~/clone
    # run unit tests
    spacejam test --driver-package=practicalmeteor:mocha-console-runner
    # run full app integration tests 
    spacejam test --full-app --driver-package=practicalmeteor:mocha-console-runner
    # start your in background 
    nohup bash -c "meteor --settings=settings.json 2>&1 &" && sleep 3m; cat nohup.out
    # then Chimp will use that instance and run acceptance tests
    chimp --ddp=http://localhost:3000 --mocha --path=chimp/tests

At line 4 and 6 use spacejam to run meteor test in command line interface. At line 10 run Meteor at background.

Published 14 Sep 2016