Skip to content
This repository was archived by the owner on Dec 9, 2021. It is now read-only.

Commit 012bad7

Browse files
committed
Adding jshint and karma.
1 parent 27bd2e8 commit 012bad7

File tree

4 files changed

+181
-0
lines changed

4 files changed

+181
-0
lines changed

.jshintrc

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"maxerr": 50,
3+
"bitwise": false,
4+
"camelcase": true,
5+
"curly": true,
6+
"eqeqeq": true,
7+
"forin": true,
8+
"immed": true,
9+
"indent": 4,
10+
"latedef": true,
11+
"newcap": true,
12+
"noarg": true,
13+
"noempty": true,
14+
"nonew": true,
15+
"plusplus": false,
16+
"quotmark": "single",
17+
"undef": true,
18+
"unused": "vars",
19+
"strict": true,
20+
"trailing": true,
21+
"maxparams": 7,
22+
"maxdepth": 4,
23+
"maxstatements": false,
24+
"maxcomplexity": false,
25+
"maxlen": 120,
26+
"asi": false,
27+
"boss": false,
28+
"debug": false,
29+
"eqnull": true,
30+
"esnext": false,
31+
"moz": false,
32+
"evil": false,
33+
"expr": false,
34+
"funcscope": false,
35+
"globalstrict": false,
36+
"iterator": false,
37+
"lastsemic": false,
38+
"laxbreak": false,
39+
"laxcomma": false,
40+
"loopfunc": false,
41+
"multistr": false,
42+
"proto": false,
43+
"scripturl": false,
44+
"smarttabs": false,
45+
"shadow": false,
46+
"sub": true,
47+
"supernew": false,
48+
"validthis": false,
49+
"browser": true,
50+
"couch": false,
51+
"devel": true,
52+
"dojo": false,
53+
"jquery": false,
54+
"mootools": false,
55+
"node": false,
56+
"nonstandard": false,
57+
"prototypejs": false,
58+
"rhino": false,
59+
"worker": true,
60+
"wsh": false,
61+
"yui": false,
62+
"nomen": false,
63+
"onevar": false,
64+
"passfail": false,
65+
"white": false,
66+
"globals": {}
67+
}

Gruntfile.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,40 @@ module.exports = function(grunt) {
301301
}
302302
},
303303

304+
// Verifies that script files conform to our standards.
305+
jshint: {
306+
options: {
307+
jshintrc: '.jshintrc'
308+
},
309+
all: {
310+
src: [
311+
'src/**/*.js'
312+
]
313+
}
314+
},
315+
316+
// Verifies that application files conform to the specification files
317+
karma: {
318+
options: {
319+
singleRun: true,
320+
configFile: 'karma.conf.js',
321+
basePath: 'scripts/',
322+
coverageReporter: {
323+
type: 'html',
324+
// path is relative to basePath
325+
// adjust to the best location for your project
326+
// and backend
327+
dir: 'build-reports/'
328+
}
329+
},
330+
unit: {
331+
reporters: ['progress']
332+
// },
333+
// coverage: {
334+
// reporters: ['progress', 'coverage']
335+
}
336+
},
337+
304338
/**
305339
* Watches files and will run task(s) when files are changed. It will also reload/refresh the browser.
306340
*/

karma.conf.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Karma configuration
2+
module.exports = function(config) {
3+
'use strict';
4+
5+
config.set({
6+
// list of files to load in the browser
7+
// NOTE: every time a vendor script is added to the project,
8+
// include a reference to that script here
9+
files: [
10+
'vendor/nerdery-function-bind/index.js',
11+
'vendor/jquery/jquery.min.js',
12+
'scripts/shim.js',
13+
'scripts/views/*.js',
14+
'scripts/*.js'
15+
],
16+
17+
// list of files to exclude
18+
exclude: [
19+
20+
],
21+
22+
// web server port
23+
port: 9876,
24+
25+
// If browser does not capture in given timeout [ms], kill it
26+
captureTimeout: 60000,
27+
28+
// enable / disable colors in the output (reporters and logs)
29+
colors: true,
30+
31+
// enable / disable watching file and executing tests whenever any file changes
32+
autoWatch: false,
33+
34+
// level of logging
35+
// possible values:
36+
// config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
37+
logLevel: config.LOG_WARN,
38+
39+
// preprocess matching files before serving them to the browser
40+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
41+
preprocessors: {
42+
'scripts/**/!(*.spec).js': 'coverage',
43+
},
44+
45+
// Start these browsers, currently available:
46+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
47+
browsers: ['PhantomJS'],
48+
49+
// frameworks to use
50+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
51+
frameworks: ['jasmine'],
52+
53+
// test results reporter to use
54+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
55+
reporters: ['progress', 'coverage'],
56+
57+
///////////////////////////////////////////////////////////////////////////
58+
// Note: the following settings are only used when running karma
59+
// directly as `karma start`.
60+
//
61+
// When running as `grunt test` these are overridden in the Gruntfile.js.
62+
// base path that will be used to resolve all patterns (eg. files, exclude)
63+
///////////////////////////////////////////////////////////////////////////
64+
65+
// Continuous Integration mode
66+
// if true, it capture browsers, run tests and exit
67+
singleRun: false,
68+
69+
// base path, that will be used to resolve files and exclude
70+
basePath: 'src/assets/',
71+
72+
// path is relative to basePath
73+
coverageReporter: {
74+
type: 'html',
75+
dir: '../../build-reports/'
76+
}
77+
});
78+
};

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"grunt-contrib-uglify": "0.2.7",
2121
"grunt-contrib-copy": "0.4.1",
2222
"grunt-contrib-clean": "0.5.0",
23+
"grunt-contrib-jshint": "0.7.2",
24+
"grunt-karma": "0.8.2",
2325
"grunt-banner": "0.2.0",
2426
"grunt-usemin": "2.0.2",
2527
"grunt-manifest": "0.4.0",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy