Coveralls using Travis ci on jasmine and istanbul

Posted: February 3, 2015 in web

package.json

"devDependencies": {
    "bower": "^1.3.3",
    "coveralls": "^2.11.2",
    "gulp-karma": "0.0.4",
    "gulp-util": "^2.2.14",
    "istanbul": "^0.3.5",
    "jasmine": "^2.1.1",
    "jasmine-core": "^2.1.3",
    "jasmine-node": "^1.14.5",
    "karma": "^0.12.31",
    "karma-coverage": "^0.2.7",
    "karma-jasmine": "^0.3.5",
    "karma-phantomjs-launcher": "^0.1.4",
    "shelljs": "^0.3.0"
  }

karma.conf.js


// Karma configuration
// Generated on Mon Feb 02 2015 10:56:11 GMT-0500 (Eastern Standard Time)

module.exports = function (config) {
    config.set({
        // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '../',
        // frameworks to use
        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
        frameworks: ['jasmine'],
        // list of files / patterns to load in the browser
        files: [
            'www/lib/angular/angular.js',
            'www/lib/angular-animate/angular-animate.js',
            'www/lib/angular-mocks/angular-mocks.js',
            'www/lib/angular-sanitize/angular-sanitize.min.js',
            'www/lib/angular-ui-router/release/angular-ui-router.js',
            'www/lib/ionic/js/ionic.js',
            'www/lib/ionic/js/ionic-angular.min.js',
            'www/js/*.js',
            'www/js/**/*.js',
//            'test/mock/**/*.js',
            'test/spec/**/*.js'
        ],
        // list of files to exclude
        exclude: [
        ],
        // preprocess matching files before serving them to the browser
        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
        preprocessors: {
            'www/js/**/!(app.js)': ['coverage']
        },
        coverageReporter: {
            type: 'lcov',
            dir: 'coverage',
            subdir: '.'
        },		
        // test results reporter to use
        // possible values: 'dots', 'progress'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        reporters: ['progress', 'coverage'],
        // web server port
        port: 9876,
        browsers: [
            'PhantomJS'
        ],
        plugins: [
            'karma-phantomjs-launcher',
            'karma-jasmine',
            'karma-coverage'
        ],
        // enable / disable colors in the output (reporters and logs)
        colors: true,
        // level of logging
        // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
        logLevel: config.LOG_INFO,
        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: true,
        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        // Continuous Integration mode
        // if true, Karma captures browsers, runs the tests and exits
        singleRun: false
    });
};



.travis.yml

language: node_js

node_js:
– ‘0.10’
script: node_modules/karma/bin/karma start test/karma.conf.js –single-run
before_script:

– ‘npm install -g bower’

– ‘bower install’
after_script: NODE_ENV=cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js && rm -rf coverage

notifications:

email:
recipients:

– nas@gmail.com

on_failure: always


Maybe optional

.coveralls.yml

repo_token: HCjFr0Cxxxxxxxxxxxxxxxxxxxxxxxxxxx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s