forked from mindmup/mapjs
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGruntFile.js
More file actions
86 lines (79 loc) · 1.76 KB
/
GruntFile.js
File metadata and controls
86 lines (79 loc) · 1.76 KB
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
/*global module*/
/*
Installing Grunt and associated contributions
- once only per machine
install node and npm:
http://nodejs.org/download/
install grunt cli:
npm install -g grunt-cli
- per project
npm install grunt-contrib-jasmine --save-dev
npm install grunt-notify --save-dev
npm install grunt-contrib-watch --save-dev
*/
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
notify: {
jasmine: {
options: {
title: 'MapJS Jasmine Tests',
message: 'jasmine test success'
}
}
},
watch: {
specs: {
files: ['test/*-spec.js'],
tasks: ['jasmine'],
options: {
spawn: false
}
},
src: {
files: ['src/*.js'],
tasks: ['jasmine', 'notify:jasmine'],
options: {
spawn: false
}
}
},
jasmine: {
all: {
src: ['src/*.js'],
options: {
template: 'test-lib/grunt.tmpl',
outfile: 'SpecRunner.html',
summary: true,
display: 'short',
keepRunner: true,
specs: [
'test/*-spec.js',
],
vendor: [
'src/mapjs.js',
grunt.option('external-scripts') || 'http://static.mindmup.com/20131204091534/external.js',
],
helpers: [
'test-lib/describe-batch.js',
'test-lib/jquery-extension-matchers.js'
]
}
}
}
});
// Load local tasks.
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.event.on('watch', function (action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
var options = grunt.config(['jasmine', 'all']);
if (target === 'specs') {
options.options.specs = [filepath];
} else {
options.options.specs = ['test/*-spec.js'];
}
grunt.config(['jasmine', 'all'], options);
});
};