This repository has been archived by the owner on Aug 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGruntfile.js
86 lines (81 loc) · 2.14 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
'use strict';
var fs = require('fs');
module.exports = function (grunt) {
var src = grunt.option('target') || ['test/integration/**/*.js'];
// Project configuration.
grunt.initConfig({
mochaTest: {
test: {
options: {
reporter: 'spec',
timeout: '60s',
slow: '20s',
require: [
function () {
/**
* Check for a local JSON file providing the enviroment variables:
* ICT_CLIENT_ID, ICT_CLIENT_SECRET, ICT_EMAIL_ID, ICT_PASSWORD
*/
if (fs.existsSync('./test/env.json')) {
var env = require('./test/env');
for (var e in env) {
if (env.hasOwnProperty(e)) {
process.env[e] = env[e];
}
}
} else {
console.warn("Couldn't find env.json. This will still work in travis-ci, but local tests will fail.");
}
}
]
},
src: src
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
lib: {
src: ['lib/**/*.js']
},
test: {
src: ['test/**/*.js']
},
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib: {
files: '<%= jshint.lib.src %>',
tasks: ['jshint:lib', 'nodeunit']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'nodeunit']
},
},
jsdoc: {
dist: {
src: ['lib/**/*.js', 'lib/*.js', 'doc/README.md'],
options: {
destination: 'dist/doc',
template: 'doc/template',
configure: 'doc/template/conf.json'
}
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jsdoc');
// Default task.
grunt.registerTask('default', ['jshint', 'mochaTest', 'jsdoc']);
};