diff --git a/.travis.yml b/.travis.yml index 5397abf98..484d1364d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js node_js: - - "0.11" - - "0.10" + - "5.6" + - "4.3" before_install: - "export CHROME_BIN=chromium-browser" @@ -13,6 +13,8 @@ before_script: script: - gulp test + - gulp coverage + - cat ./coverage/lcov.info | ./node_modules/.bin/coveralls notifications: slack: chartjs:pcfCZR6ugg5TEcaLtmIfQYuA diff --git a/README.md b/README.md index d86543f8b..4be188e8f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Chart.js -[![Build Status](https://travis-ci.org/nnnick/Chart.js.svg?branch=v2.0-dev)](https://travis-ci.org/nnnick/Chart.js) [![Code Climate](https://codeclimate.com/github/nnnick/Chart.js/badges/gpa.svg)](https://codeclimate.com/github/nnnick/Chart.js) +[![Build Status](https://travis-ci.org/nnnick/Chart.js.svg?branch=v2.0-dev)](https://travis-ci.org/nnnick/Chart.js) [![Code Climate](https://codeclimate.com/github/nnnick/Chart.js/badges/gpa.svg)](https://codeclimate.com/github/nnnick/Chart.js)[![Coverage Status](https://coveralls.io/repos/nnnick/Chart.js/badge.svg?branch=v2.0-dev)](https://coveralls.io/r/nnncik/Chart.js?branch=v2.0-dev) + *Simple HTML5 Charts using the canvas element* [chartjs.org](http://www.chartjs.org) diff --git a/gulpfile.js b/gulpfile.js index 7b2710983..5b64a1920 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -133,7 +133,7 @@ function validHTMLTask() { function unittestTask() { - var files = ['./dist/Chart.bundle.js'] + var files = ['./src/**/*.js']; Array.prototype.unshift.apply(files, preTestFiles); Array.prototype.push.apply(files, testFiles); @@ -145,7 +145,7 @@ function unittestTask() { } function unittestWatchTask() { - var files = ['./dist/Chart.bundle.js'] + var files = ['./src/**/*.js']; Array.prototype.unshift.apply(files, preTestFiles); Array.prototype.push.apply(files, testFiles); @@ -157,7 +157,7 @@ function unittestWatchTask() { } function coverageTask() { - var files = ['./dist/Chart.bundle.js'] + var files = ['./src/**/*.js']; Array.prototype.unshift.apply(files, preTestFiles); Array.prototype.push.apply(files, testFiles); diff --git a/karma.conf.ci.js b/karma.conf.ci.js index d6ee47bf2..7ed5d0fe2 100644 --- a/karma.conf.ci.js +++ b/karma.conf.ci.js @@ -7,8 +7,14 @@ module.exports = function(config) { flags: ['--no-sandbox'] } }, - frameworks: ['jasmine'], + frameworks: ['browserify', 'jasmine'], reporters: ['progress', 'html'], + preprocessors: { + 'src/**/*.js': ['browserify'] + }, + browserify: { + debug: true + } }; if (process.env.TRAVIS) { diff --git a/karma.conf.js b/karma.conf.js index bce079624..acdff3f9c 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,7 +1,14 @@ module.exports = function(config) { config.set({ browsers: ['Chrome', 'Firefox'], - frameworks: ['jasmine'], + frameworks: ['browserify', 'jasmine'], reporters: ['progress', 'html'], + + preprocessors: { + 'src/**/*.js': ['browserify'] + }, + browserify: { + debug: true + } }); }; \ No newline at end of file diff --git a/karma.coverage.conf.js b/karma.coverage.conf.js index cc047aa4d..dd70f701a 100644 --- a/karma.coverage.conf.js +++ b/karma.coverage.conf.js @@ -1,18 +1,43 @@ module.exports = function(config) { - config.set({ - browsers: ['Chrome', 'Firefox'], + var configuration = { + browsers: ['Firefox'], - coverageReporter: { - type: 'html', - dir: 'coverage/' - }, - - frameworks: ['jasmine'], + frameworks: ['browserify', 'jasmine'], preprocessors: { - 'src/**/*.js': ['coverage'] + 'src/**/*.js': ['browserify'] + }, + browserify: { + debug: true, + transform: [['browserify-istanbul', { + instrumenterConfig: { + embed: true + } + }]] }, reporters: ['progress', 'coverage'], - }); + coverageReporter: { + dir: 'coverage/', + reporters: [ + { type: 'html', subdir: 'report-html' }, + { type: 'lcovonly', subdir: '.', file: 'lcov.info' } + ] + } + }; + + // If on the CI, use the CI chrome launcher + if (process.env.TRAVIS) { + configuration.browsers.push('Chrome_travis_ci'); + configuration.customLaunchers = { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }; + } else { + configuration.browsers.push('Chrome'); + } + + config.set(configuration); }; \ No newline at end of file diff --git a/package.json b/package.json index 3f3602dcf..b31416507 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ }, "devDependencies": { "browserify": "^13.0.0", + "browserify-istanbul": "^0.2.1", + "coveralls": "^2.11.6", "gulp": "3.9.x", "gulp-concat": "~2.1.x", "gulp-connect": "~2.0.5", @@ -26,7 +28,9 @@ "jasmine": "^2.3.2", "jasmine-core": "^2.3.4", "jquery": "^2.1.4", + "jshint-stylish": "~2.1.0", "karma": "^0.12.37", + "karma-browserify": "^5.0.1", "karma-chrome-launcher": "^0.2.0", "karma-coverage": "^0.5.1", "karma-firefox-launcher": "^0.1.6", @@ -34,8 +38,7 @@ "karma-jasmine-html-reporter": "^0.1.8", "merge-stream": "^1.0.0", "semver": "^3.0.1", - "vinyl-source-stream": "^1.1.0", - "jshint-stylish": "~2.1.0" + "vinyl-source-stream": "^1.1.0" }, "spm": { "main": "Chart.js"