Browse Source

Change test framework from grunt-contrib-jasmine to karma

pull/1403/head
Yoshiya Hinosawa 9 years ago
parent
commit
15b9fc23e4
  1. 4
      .travis.yml
  2. 13
      Gruntfile.coffee
  3. 71
      karma.conf.js
  4. 11
      package.json

4
.travis.yml

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

13
Gruntfile.coffee

@ -85,15 +85,6 @@ 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'
uglify:
c3:
files:
@ -111,4 +102,6 @@ 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 'build', ['concat', 'sass', 'cssmin', 'uglify']
grunt.registerTask 'defualt', ['lint', 'build']

71
karma.conf.js

@ -0,0 +1,71 @@
// 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: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec'],
// 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_DEBUG,
// 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,
})
}

11
package.json

@ -4,7 +4,8 @@
"description": "D3-based reusable chart library",
"main": "c3.js",
"scripts": {
"test": "grunt"
"lint": "grunt lint",
"test": "karma start karma.conf.js"
},
"repository": {
"type": "git",
@ -26,11 +27,15 @@
"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-sass": "^0.17.0",
"load-grunt-tasks": "~0.2.0"
"jasmine-core": "^2.3.4",
"karma": "^0.13.10",
"karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "^0.2.1",
"load-grunt-tasks": "~0.2.0",
"phantomjs": "^1.9.18"
}
}

Loading…
Cancel
Save