-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathGruntfile.js
executable file
·93 lines (84 loc) · 3.12 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
87
88
89
90
91
92
93
module.exports = function(grunt) {
'use strict';
//load npm tasks
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
mocha : {
browser : {
//src : ['test/**/index.html'],
options : {
urls : [
'http://localhost:9901/test/properties/index.html',
'http://localhost:9901/test/methods/index.html',
'http://localhost:9901/test/integration/index.html'
],
reporter : 'Spec',
run : true,
timeout : 10000
}
}
},
'blanket_mocha' : {
browser : {
//src : ['test/**/index.html'],
options : {
threshold : 1,
urls : [
'http://localhost:9901/test/properties/index.html',
'http://localhost:9901/test/methods/index.html',
'http://localhost:9901/test/integration/index.html'
],
reporter : 'Spec',
run : true,
timeout : 10000
}
}
},
connect : {
test : {
options : {
hostname : 'localhost',
port : 9901,
base : '.',
middleware: function(connect, options, middlewares) {
var url = require('url');
return [function(req, res, next) {
if(/(jsonp)|(callback)/.test(req.url)){
var parsed = url.parse(req.url, true);
var path = parsed.pathname.replace(/^\//, '');
var jsonp = parsed.query.jsonp || parsed.query.callback;
return res.end(jsonp + '(' + grunt.file.read(path) + ');');
}
return next();
}].concat(middlewares);
},
}
}
},
watch : {
test : {
files: '**/*.js',
tasks: ['mocha:browser'],
options: {
debounceDelay: 2000,
}
}
},
jsdoc : {
dist : {
src: ['src/*.js', 'README.md'],
options: {
destination: 'doc',
template : "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template",
configure : "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template/jsdoc.conf.json"
}
}
}
});
//tasks related unit tests
//grunt.registerTask('test', ['connect:test', 'mocha:browser']);
grunt.registerTask('test', ['connect:test', 'blanket_mocha:browser']);
grunt.registerTask('devtest', ['connect:test', 'watch:test']);
};