Last Updated: February 25, 2016
·
2.369K
· eskimoblood

Run your BusterJs test with Grunt on TravisCI

Lets asume you run your test locally with grunt-buster. Its very easy to run this test on TravisCI. All you have to do is do configure your package.json correctly so Travis can get all the dependencies that it needs to run grunt, grunt-buster and buster. So your minimal package.json file will look like this:

{
  "main": "./lib/somefile.js",

  "devDependencies": {
    "buster": "~0.6.0",
    "grunt": "0.3.15",
    "grunt-buster": "~0.1.2"
  }
}

When Travis starts the test it will call automatically call npm install before it runs the tests. As we defined all our dependencies it will download and install buster,grunt and grunt-buster.

So the minimal grunt file to run buster will look like this:

module.exports = function(grunt) {

  grunt.initConfig({
    buster: {
      test: {
        config: 'test/buster.js'
      },
      server: {
        port: 1111
      }
    }
  });
  grunt.loadNpmTasks('grunt-buster');
};

With this grunt file we can run the test locally by calling grunt buster and thats same travis should to. So our travis.yml file needs a script block with this single command

script:
  - "grunt buster"

language: node_js

node_js:
  - 0.6
before_script:
  - npm install -g grunt-cli

And thats it.

1 Response
Add your response

To make this work I had to put buster as a dependency to be installed in the before_script.

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside