Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

[Travis CI] Aug 23 2015

Brosnan Yuen edited this page Aug 23, 2015 · 4 revisions

For dev branch only not master

Travis CI is a cloud service that builds and tests software packages.I am focusing on node.js ,grunt, and qunit.

The basic idea is the package runs grunt. Then grunt runs the qunit tests. If the qunit tests pass then the badge will be green.

Build Status

Starting with .travis.yml

sudo: false
language: node_js
node_js:
  - "0.12"
  - "0.11"
  - "0.10"
before_install:
  - npm install -g npm
before_script:
  - npm install -g grunt-cli

The language of the tests is set to node.js which is javascript. The versions 0.10, 0.11, 0.12 tell it to only run tests under those. npm install -g grunt-cli tells it to install grunt before running the script.

package.json

{
    "author": {
        "name": "Martin Donk",
        "email": "[email protected]"
    },
    "description": "javascript light-weight symbolic math expression evaluator",
    "name": "nerdamer",
    "license": "MIT",
    "version": "0.5.8",
    "homepage": "http://nerdamer.com/",
    "keywords": [
        "math",
        "symbolic",
        "integration",
        "differentiation",
        "derivative",
        "algebra",
        "calculus",
        "fourier",
        "symbolic math"
    ],
    "scripts": {
        "test": "grunt test"
    },
    "repository": {
        "type": "git",
        "url": "https://github.com/jiggzson/nerdamer.git"
    },
    "bugs": {
        "url": "https://github.com/jiggzson/nerdamer/issues"
    },
    "devDependencies": {
        "grunt": "^0.4.5",
        "grunt-contrib-qunit": "~0.7.0"
    },
    "engines": {
        "node": ">=0.10.0"
    }
}

The information for a node.js package. The important part is the scripts. It tells node.js to run grunt.

Grunt looks for a file called Gruntfile.js

module.exports = function(grunt) {
    // Project configuration.
    grunt.initConfig({
        qunit: {
            files: ['tests/test.html']
        }
    });

    // Load plugin
    grunt.loadNpmTasks('grunt-contrib-qunit');

    // Task to run tests
    grunt.registerTask('test', 'qunit');
};

It uses qunit to go through all the tests.

Well on to packaging for npm.

-- Brosnan Yuen