Meteor -Travis Integration

Lawrence Chege
Nov 1 · 3 min read

So you are doing unit testing with meteor now. Your tests are working offline but now you want to run them online. With every push, every pull-request you want to see if you broke something. That is where continuous integration comes in place. Various solutions are available to help you integrate seamlessly. Below are a few examples.

For this tutorial, we are going to use Travis CI, Top of the list :-).

Step One: Add Travis CI Github App

  • Click on setup free trial
  • Click on open source and then Install for free
  • Click on complete order and begin the installation. If you have billing issues switch to the free yearly plan

You can allow all repositories or you can specify the repository you want to be accessed. Enter your Github password and allow Travis access.

Step Two: Travis Setup

If you go to Travis CI, you will see a list of all repositories you authorized Travis to test. Each will have a trigger build button.

  • If you press that button, the build will run and then fail. This is because we don't have a configuration file for Travis.
  • On your local repository, on the root folder of your project next to your package.json, create a .travis.yml file
touch .travis.yml

On the Travis file, add the following configuration.

language: node_jsnode_js:- "10"before_script:# Install meteor- curl https://install.meteor.com | /bin/sh# Add meteor to path (instead of asking for sudo in the Travis container)# We can then use the faster container infrastructure - http://docs.travis-ci.com/user/workers/container-based-infrastructure/- export PATH=$HOME/.meteor:$PATH- npm install -g spacejamcache:directories:- node_modules

After adding it

git add .travis.yml

Then

git commit -m "add travis config file"

Then

git push

If your tests were passing locally, expect them to pass on Travis.

Step Three: Add badge

Now to add a badge that shows that your tests are passing.

Click on the build passing button. It might be saying build unknown, once you click, a drop-down pop out. On the format, choose markdown.

Copy the contents of the result and paste them in your README.md

Aviato!

Lawrence Chege

Written by

Engineer and Tech-entrepreneur

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade