This repository has been archived by the owner on Sep 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add Gruntfile, update Karma configuration & fix JSHint errors
Leveraging Grunt to check for style issues and run the Karma tests makes it easier to run those processes. The Gruntfile in use here is based on that of ui-utils, and the Karma config file (which has been renamed Karma.conf.js for consistency with other projects) has been re-generated with karma init.
- Loading branch information
1 parent
487f35a
commit c322455
Showing
8 changed files
with
215 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"curly": true, | ||
"eqeqeq": true, | ||
"immed": true, | ||
"latedef": true, | ||
"newcap": true, | ||
"noarg": true, | ||
"sub": true, | ||
"boss": true, | ||
"eqnull": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module.exports = function (grunt) { | ||
'use strict'; | ||
|
||
var initConfig; | ||
|
||
// Loading external tasks | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-karma'); | ||
|
||
// Project configuration. | ||
initConfig = { | ||
bower: 'bower_components', | ||
pkg: grunt.file.readJSON('package.json'), | ||
watch: { | ||
// Lint & run unit tests in Karma | ||
// Just running `$ grunt watch` will only lint your code; to run tests | ||
// on watch, use `$ grunt watch:karma` to start a Karma server first | ||
files: ['src/select2.js', 'test/select2Spec.js'], | ||
tasks: ['jshint', 'karma:headless:run'] | ||
}, | ||
karma: { | ||
options: { | ||
configFile: 'test/karma.conf.js' | ||
}, | ||
unit: { | ||
singleRun: true, | ||
browsers: ['Firefox', 'PhantomJS'] | ||
}, | ||
headless: { | ||
singleRun: true, | ||
browsers: ['PhantomJS'] | ||
}, | ||
server: { | ||
background: true, | ||
browsers: ['Firefox', 'PhantomJS'] | ||
} | ||
}, | ||
jshint: { | ||
all:[ | ||
'gruntFile.js', | ||
'src/**/*.js', | ||
'test/**/*Spec.js' | ||
], | ||
options: { | ||
jshintrc: '.jshintrc' | ||
} | ||
}, | ||
}; | ||
|
||
// Register tasks | ||
grunt.registerTask('default', ['jshint', 'karma:unit']); | ||
grunt.registerTask('watch:karma', ['karma:server', 'watch']); | ||
|
||
grunt.initConfig(initConfig); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Karma configuration | ||
// Generated on Tue Sep 17 2013 06:59:46 GMT-0400 (EDT) | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
|
||
// base path, that will be used to resolve files and exclude | ||
basePath: '..', | ||
|
||
|
||
// frameworks to use | ||
frameworks: ['jasmine'], | ||
|
||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
// Dependencies | ||
'bower_components/jquery/jquery.js', | ||
'bower_components/angular/angular.js', | ||
'bower_components/angular-mocks/angular-mocks.js', | ||
'bower_components/select2/select2.js', | ||
|
||
// Source Code | ||
'src/select2.js', | ||
|
||
// Test Specs | ||
'test/*Spec.js' | ||
], | ||
|
||
|
||
// list of files to exclude | ||
exclude: [ | ||
|
||
], | ||
|
||
|
||
// test results reporter to use | ||
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' | ||
reporters: ['progress'], | ||
|
||
|
||
// 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: false, | ||
|
||
|
||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera | ||
// - Safari (only Mac) | ||
// - PhantomJS | ||
// - IE (only Windows) | ||
browsers: ['Chrome', 'Firefox'], | ||
|
||
|
||
// If browser does not capture in given timeout [ms], kill it | ||
captureTimeout: 60000, | ||
|
||
|
||
// Continuous Integration mode | ||
// if true, it capture browsers, run tests and exit | ||
singleRun: false | ||
|
||
|
||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.