Browse Source

Merge branch 'kt3k-feature/coverage'

pull/1414/merge
Masayuki Tanaka 9 years ago
parent
commit
ff6a9302be
  1. 3
      .gitignore
  2. 7
      .travis.yml
  3. 19
      Gruntfile.coffee
  4. 77
      karma.conf.js
  5. 16
      package.json

3
.gitignore vendored

@ -6,3 +6,6 @@ d3.min.js
components
build
.sass-cache
# coverage report
/coverage

7
.travis.yml

@ -3,3 +3,10 @@ language: node_js
before_script:
- npm install -g grunt-cli
- gem install sass
script:
- npm run lint
- npm test
after_success:
- npm run codecov

19
Gruntfile.coffee

@ -1,5 +1,5 @@
module.exports = (grunt) ->
require('load-grunt-tasks') grunt, pattern: ['grunt-contrib-*', 'grunt-sass']
require('load-grunt-tasks') grunt, pattern: ['grunt-contrib-*', 'grunt-sass', 'grunt-karma']
grunt.initConfig
watch:
@ -85,14 +85,9 @@ module.exports = (grunt) ->
options:
jshintrc: '.jshintrc'
jasmine:
c3:
src: 'c3.js'
options:
specs: 'spec/*-spec.js'
helpers: 'spec/*-helper.js'
styles: 'c3.css'
vendor: 'https://rawgit.com/mbostock/d3/v3.5.0/d3.min.js'
karma:
unit:
configFile: 'karma.conf.js'
uglify:
c3:
@ -111,4 +106,8 @@ module.exports = (grunt) ->
files:
'c3.css': 'src/scss/main.scss'
grunt.registerTask 'default', ['concat', 'jshint', 'jasmine', 'sass', 'cssmin', 'uglify']
grunt.registerTask 'lint', ['jshint']
grunt.registerTask 'test', ['karma']
grunt.registerTask 'build', ['concat', 'sass']
grunt.registerTask 'minify', ['cssmin', 'uglify']
grunt.registerTask 'default', ['lint', 'build', 'test', 'minify']

77
karma.conf.js

@ -0,0 +1,77 @@
// Karma configuration
// Generated on Wed Sep 30 2015 22:01:48 GMT+0900 (KST)
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: [
'node_modules/d3/d3.min.js',
'c3.js',
'c3.css',
'spec/*-helper.js',
'spec/*-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: {
'c3.js': ['coverage']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec', 'coverage'],
coverageReporter: {
reporters: [{type: 'lcov'}]
},
// web server port
port: 9876,
// 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
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
browserNoActivityTimeout: 60000,
})
}

16
package.json

@ -4,7 +4,9 @@
"description": "D3-based reusable chart library",
"main": "c3.js",
"scripts": {
"test": "grunt"
"lint": "grunt lint",
"test": "karma start karma.conf.js",
"codecov": "cat coverage/*/lcov.info | codecov"
},
"repository": {
"type": "git",
@ -23,14 +25,22 @@
"d3": "<=3.5.0"
},
"devDependencies": {
"codecov.io": "^0.1.6",
"grunt": "^0.4.5",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-cssmin": "^0.10.0",
"grunt-contrib-jasmine": "~0.8.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-karma": "^0.12.1",
"grunt-sass": "^0.17.0",
"load-grunt-tasks": "~0.2.0"
"jasmine-core": "^2.3.4",
"karma": "^0.13.10",
"karma-coverage": "^0.5.2",
"karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "^0.2.1",
"karma-spec-reporter": "0.0.20",
"load-grunt-tasks": "~0.2.0",
"phantomjs": "^1.9.18"
}
}

Loading…
Cancel
Save