1 | /**
|
2 | * Copyright 2013, 2014 IBM Corp.
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | **/
|
16 |
|
17 | module.exports = function(grunt) {
|
18 |
|
19 | // Project configuration.
|
20 | grunt.initConfig({
|
21 | pkg: grunt.file.readJSON('package.json'),
|
22 | simplemocha: {
|
23 | options: {
|
24 | globals: ['expect'],
|
25 | timeout: 3000,
|
26 | ignoreLeaks: false,
|
27 | ui: 'bdd',
|
28 | reporter: 'tap'
|
29 | },
|
30 | all: { src: ['test/*.js'] }
|
31 | },
|
32 | jshint: {
|
33 | options: {
|
34 | // http://www.jshint.com/docs/options/
|
35 | "asi": true, // allow missing semicolons
|
36 | "curly": true, // require braces
|
37 | "eqnull": true, // ignore ==null
|
38 | "forin": true, // require property filtering in "for in" loops
|
39 | "immed": true, // require immediate functions to be wrapped in ( )
|
40 | "nonbsp": true, // warn on unexpected whitespace breaking chars
|
41 | "strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually
|
42 | "loopfunc": true, // allow functions to be defined in loops
|
43 | "sub": true // don't warn that foo['bar'] should be written as foo.bar
|
44 | },
|
45 | all: [
|
46 | 'Gruntfile.js',
|
47 | 'JsonDB.js',
|
48 | 'lib/*.js'
|
49 | ],
|
50 | lib: {
|
51 | files: {
|
52 | src: [ 'lib/*.js' ]
|
53 | }
|
54 | },
|
55 | module: {
|
56 | files: {
|
57 | src: [
|
58 | 'JsonDB.js'
|
59 | ]
|
60 | }
|
61 | },
|
62 | tests: {
|
63 | files: {
|
64 | src: ['test/*.js']
|
65 | },
|
66 | options: {
|
67 | "expr": true
|
68 | }
|
69 | }
|
70 |
|
71 | }
|
72 | });
|
73 |
|
74 | grunt.loadNpmTasks('grunt-simple-mocha');
|
75 | grunt.loadNpmTasks('grunt-contrib-jshint');
|
76 |
|
77 | grunt.registerTask('default', ['jshint:lib','jshint:module','simplemocha']);
|
78 | grunt.registerTask('all', ['jshint:tests','default']);
|
79 |
|
80 | };
|