Browse Source

Moves test runner into grunt task for travis

pull/258/head
jlukic 11 years ago
parent
commit
60fcad33ca
4 changed files with 46 additions and 9 deletions
  1. 4
      .travis.yml
  2. 37
      node/Gruntfile.js
  3. 12
      node/package.json
  4. 2
      package.json

4
.travis.yml

@ -3,4 +3,6 @@ node_js:
- "0.10"
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sh -e /etc/init.d/xvfb start
- npm install -g grunt-cli
- grunt test

37
node/Gruntfile.js

@ -3,7 +3,7 @@ module.exports = function(grunt) {
var
defaultTasks = [
// watch less folder
// run grunt watch
'watch'
],
@ -15,7 +15,13 @@ module.exports = function(grunt) {
'copy:srcToDocs',
// copies examples over to docs
'copy:examplesToDocs'
'copy:examplesToDocs',
],
testTasks = [
// test components
'karma:test:run'
],
buildTasks = [
@ -109,10 +115,16 @@ module.exports = function(grunt) {
// watches for changes in a source folder
watch: {
options: {
spawn: false
},
scripts: {
options: {
spawn: false
},
files: [
'../src/**/*.js'
],
tasks : testTasks
},
src: {
files: [
'../build/examples/**/*',
'../src/**/*.less',
@ -122,6 +134,18 @@ module.exports = function(grunt) {
}
},
/*******************************
Test
*******************************/
karma: {
test: {
configFile : '../test/karma.conf.js',
background : true,
reporters: 'dots'
}
},
/*******************************
Build
*******************************/
@ -488,12 +512,13 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-docco-multi');
grunt.loadNpmTasks('grunt-cssjanus');
grunt.loadNpmTasks('grunt-karma');
grunt.initConfig(config);
grunt.registerTask('default', defaultTasks);
grunt.registerTask('build', buildTasks);
grunt.registerTask('test', testTasks);
// compiles only changed less files <https://npmjs.org/package/grunt-contrib-watch>
grunt.event.on('watch', setWatchFiles);

12
node/package.json

@ -23,6 +23,16 @@
"grunt-contrib-compress": "~0.5.2",
"grunt-contrib-concat": "~0.3.0",
"grunt-docco-multi": "0.0.2",
"grunt-cssjanus": "~0.1.1"
"grunt-cssjanus": "~0.1.1",
"karma-script-launcher": "~0.1.0",
"karma-chrome-launcher": "~0.1.0",
"karma-firefox-launcher": "~0.1.0",
"karma-html2js-preprocessor": "~0.1.0",
"karma-jasmine": "~0.1.3",
"karma-requirejs": "~0.1.0",
"karma-coffee-preprocessor": "~0.1.0",
"karma-phantomjs-launcher": "~0.1.0",
"karma": "~0.10.2",
"grunt-karma": "~0.6.2"
}
}

2
package.json

@ -11,7 +11,7 @@
"karma": "~0.8"
},
"scripts": {
"test": "./node_modules/.bin/karma start --browsers Firefox --single-run"
"test": "grunt travis --verbose"
},
"license": "MIT"
}
Loading…
Cancel
Save