Skip to content

Commit

Permalink
using npm script instead of grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbbottam committed Apr 22, 2016
1 parent 3d35d61 commit bde6673
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 225 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_js:
- stable
script:
- npm test
- npm run example
- npm run-script deploy
after_script:
- npm run coveralls
Expand Down
6 changes: 0 additions & 6 deletions Gruntfile.js

This file was deleted.

71 changes: 71 additions & 0 deletions karma.conf.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Karma configuration
// Generated on Mon Jun 08 2015 15:45:45 GMT-0700 (PDT)

module.exports = {
// 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: ['mocha', 'chai', 'commonjs'],

// list of files / patterns to load in the browser
files: [
'src/**/*.js',
'polyfill/**/*.js',
'test/**/*.js'
],

// list of files to exclude
exclude: [
'src/**/bundle.js'
],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/**/*.js': ['coverage', 'commonjs'],
'polyfill/**/*.js': ['commonjs'],
'test/**/*.js': ['commonjs']
},

coverageReporter: {
reporters: [{
type: 'lcov',
dir:'coverage/'
}, {
type: 'json',
dir:'coverage/',
file : 'coverage.json'
}]
},

thresholdReporter: {
statements: 100,
branches: 100,
functions: 100,
lines: 100
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage', 'threshold'],

// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
};
51 changes: 51 additions & 0 deletions karma.conf.ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
var customLaunchers = {
'SL_Chrome': {
base: 'SauceLabs',
browserName: 'chrome'
},
'SL_InternetExplorer': {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '10'
},
'SL_FireFox': {
base: 'SauceLabs',
browserName: 'firefox'
}
};

var conf = Object.assign( require('./karma.conf.base.js'), {
coverageReporter: {
reporters: [{
type: 'lcov',
dir: 'coverage/',
subdir: '.'
}, {
type: 'json',
dir: 'coverage/',
subdir: '.',
file: 'coverage.json'
}]
},
junitReporter: {
outputFile: 'test-results.xml',
suite: ''
},
reporters: [
'progress',
'coverage',
'threshold',
'junit',
'saucelabs'
],
sauceLabs: {
testName: 'accessible-dropdown'
},
captureTimeout: 120000,
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers)
})

module.exports = function(config) {
config.set(conf);
};
5 changes: 5 additions & 0 deletions karma.conf.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var conf = require('./karma.conf.base.js');

module.exports = function(config) {
config.set(conf);
};
83 changes: 0 additions & 83 deletions karma.conf.js

This file was deleted.

19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,29 @@
"src"
],
"devDependencies": {
"browserify": "^13.0.0",
"chai": "^3.0.0",
"coveralls": "^2.11.2",
"grunt": "~0.4.2",
"grunt-browserify": "^3.8.0",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-eslint": "^15.0.0",
"grunt-karma": "~0.11.0",
"eslint": "^2.8.0",
"karma": "~0.12.36",
"karma-chai": "~0.1.0",
"karma-chrome-launcher": "~0.1.12",
"karma-cli": "^0.1.2",
"karma-commonjs": "0.0.13",
"karma-coverage": "~0.3.1",
"karma-junit-reporter": "~0.2.2",
"karma-mocha": "~0.1.10",
"karma-sauce-launcher": "^0.2.11",
"karma-threshold-reporter": "~0.1.15",
"load-grunt-tasks": "~0.2.0",
"mocha": "^2.2.5"
},
"scripts": {
"test": "grunt js:ci",
"lint": "eslint src/**/* test/**/*",
"test": "npm run lint && karma start karma.conf.ci.js",
"dev": "npm run lint && karma start karma.conf.dev.js",
"example": "browserify example/common.js -o example/main.js",
"deploy": "./script/deploy.sh",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls",
"dev": "grunt js"
"coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"
},
"repository": {
"type": "git",
Expand Down
30 changes: 0 additions & 30 deletions tasks/dev.js

This file was deleted.

95 changes: 0 additions & 95 deletions tasks/js.js

This file was deleted.

0 comments on commit bde6673

Please sign in to comment.