Skip to content

Commit

Permalink
Setup more karma test configs in grunt
Browse files Browse the repository at this point in the history
Added a continuous karma testing config which will reload the test each
time a file is changed. A release config was also added which will run
each test within `PhantomJS`, `Chrome` and `Firefox`.

A `jasmine` support directory was initialised with the `spec` directory
replacing the previous `test` directory. This was generated from
initialising `jasmine`.
  • Loading branch information
Josh Leeb-du Toit committed Aug 22, 2015
1 parent 9f0980c commit 083ab20
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 35 deletions.
7 changes: 7 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ module.exports = function (grunt) {
configFile: 'karma.conf.js',
},
unit: {
browsers: ['PhantomJS'],
autoWatch: false,
singleRun: true
},
dev: {
browsers: ['PhantomJS'],
autoWatch: true,
singleRun: false
},
release: {
browsers: ['PhantomJS', 'Chrome', 'Firefox'],
autoWatch: false,
singleRun: true
}
},

Expand Down
50 changes: 17 additions & 33 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,18 @@
/*
* angular-google-places-autocomplete
*
* Copyright (c) 2014 "kuhnza" David Kuhn
* Licensed under the MIT license.
* https://github.com/kuhnza/angular-google-places-autocomplete/blob/master/LICENSE
*/

'use strict';

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
logLevel: 'INFO',
browsers: ['PhantomJS'],
autoWatch: true,
reporters: ['progress', 'coverage'],
files: [
'https://maps.googleapis.com/maps/api/js?libraries=places',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/**/*.js',
'test/**/*.js'
],
preprocessors: {
'src/**/*.js': 'coverage'
},
coverageReporter: {
type: 'html',
dir: 'coverage/'
}
});
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/**/*.js',
'spec/**/*.js'
],
exclude: [],
preprocessors: {},
reporters: ['mocha'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
});
};
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-uglify": "~0.4.0",
"grunt-karma": "~0.8.2",
"grunt-karma": "~0.11.0",
"jshint-stylish": "^2.0.1",
"karma": "~0.12.0",
"karma": "0.12.0",
"karma-chrome-launcher": "~0.1.2",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-coverage": "~0.2.0",
"karma-jasmine": "~0.2.1",
"karma-mocha-reporter": "^1.1.1",
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions spec/support/jasmine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"spec_dir": "spec",
"spec_files": [
"**/*[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
]
}

0 comments on commit 083ab20

Please sign in to comment.