-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
104 lines (87 loc) · 2.07 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
94
95
96
97
98
99
100
101
102
103
104
'use strict';
module.exports = function (grunt) {
const gtx = require('./lib/gtx').wrap(grunt);
gtx.loadAuto();
gtx.loadTasks('./test/test_tasks');
gtx.config({
pkg: gtx.readJSON('package.json', {
extra: 'foo'
}),
clean: {
tmp: ['tmp/**/*', 'test/tmp**/*']
},
jshint: {
options: {
reporter: './node_modules/jshint-path-reporter',
jshintrc: '.jshintrc'
},
core: {
src: [
'Gruntfile.js', 'lib/**/*.js', 'tasks/**/*.js'
]
}
},
mochaTest: {
options: {
reporter: 'mocha-unfunk-reporter'
}
},
run_grunt: {
options: {
'no-color': true,
debugCli: false
}
}
});
// assemble a macro
gtx.define('testCase', function (macro, id) {
var specPath = 'test/spec/' + id + '/';
macro.log(specPath);
//TODO needs a macro.once()
macro.run('prep');
macro.add('clean', [specPath + 'tmp']);
macro.add('jshint', {
src: [
specPath + '**/*.js'
]
});
macro.add('run_grunt', {
options: {
log: macro.getParam('log', false),
logFile: specPath + 'tmp/log.txt',
// check exported data
parser: 'parseHelp',
help: true,
stack: true,
process: function (result) {
grunt.file.write(specPath + 'tmp/tasks.json', JSON.stringify(result.parsed, null, 2));
}
},
src: [specPath + 'Gruntfile.js']
});
macro.add('mochaTest', {
src: ['test/spec/init.js', specPath + '**/*.test.js']
});
macro.tag('test');
}, {
concurrent: 2
});
// build main aliases
gtx.alias('prep', ['jshint:core']);
gtx.alias('default', ['test']);
// use the macro
gtx.create('basic,concurrent', 'testCase', {
log: true
});
gtx.create('dummy', 'testCase', {
log: true
});
gtx.create('anon', 'testCase', {
log: true
});
gtx.alias('test', ['gtx-group:test']);
gtx.alias('dev', ['gtx-type:testCase']);
gtx.alias('edit_01', 'gtx:basic');
gtx.alias('edit_02', 'gtx:dummy');
gtx.finalise();
};