forked from bbyars/mountebank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
109 lines (101 loc) · 3.98 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
105
106
107
108
109
'use strict';
var port = process.env.MB_PORT || 2525;
module.exports = function (grunt) {
require('time-grunt')(grunt);
grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-mountebank');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-css');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), // needed for coveralls
mochaTest: {
unit: {
options: {
reporter: 'spec'
},
src: ['test/**/*.js']
},
functional: {
options: {
reporter: 'spec'
},
src: ['functionalTest/**/*.js']
},
performance: {
options: {
reporter: 'spec'
},
src: ['performanceTest/**/*.js']
}
},
eslint: {
target: [
'Gruntfile.js',
'src/**/*.js',
'tasks/**/*.js',
'test/**/*.js',
'functionalTest/**/*.js',
'performanceTest/**/*.js',
'bin/mb'
]
},
jsdoc: {
dist: {
src: ['src/**/*.js'],
options: {
destination: 'docs',
configure: '.jsdoc',
pedantic: true,
readme: 'CONTRIBUTING.md',
package: 'dist/mountebank/package.json' // use dist to get correct version
}
}
},
mb: {
options: {
path: 'bin/mb',
pathEnvironmentVariable: 'MB_EXECUTABLE'
},
restart: ['--port', port, '--pidfile', 'mb-grunt.pid', '--logfile', 'mb-grunt.log', '--allowInjection', '--mock', '--debug'],
stop: ['--pidfile', 'mb-grunt.pid']
},
csslint: {
strict: {
options: {
important: 2,
ids: 2
},
all: [
'src/**/*.css',
'!src/**/jquery-ui.css'
]
}
}
});
grunt.registerTask('setAirplaneMode', function () {
process.env.MB_AIRPLANE_MODE = 'true';
});
grunt.registerTask('test:unit', 'Run the unit tests', ['mochaTest:unit']);
grunt.registerTask('test:functional', 'Run the functional tests',
['mb:restart', 'try', 'mochaTest:functional', 'finally', 'mb:stop', 'checkForErrors']);
grunt.registerTask('test:performance', 'Run the performance tests', ['mochaTest:performance']);
grunt.registerTask('test', 'Run all non-performance tests', ['test:unit', 'test:functional']);
grunt.registerTask('lint', 'Run all lint checks', ['jsCheck', 'deadCheck', 'eslint']);
grunt.registerTask('default', ['test', 'lint']);
grunt.registerTask('airplane', 'Build that avoids tests requiring network access', ['setAirplaneMode', 'default']);
// Package-specific testing
grunt.registerTask('test:tarball:x64', 'Run tests against packaged tarball',
['dist', 'version', 'dist:tarball:x64', 'install:tarball:x64', 'test', 'lint']);
grunt.registerTask('test:zip', 'Run tests against packaged zipfile',
['download:zip', 'install:zip', 'test', 'lint']);
grunt.registerTask('test:npm', 'Run tests against npm package',
['dist', 'version', 'dist:npm', 'install:npm', 'test']);
grunt.registerTask('test:pkg', 'Run tests against OSX pkg file',
['dist', 'version', 'dist:package:osxpkg', 'install:pkg', 'test']);
grunt.registerTask('test:deb', 'Run tests against Debian package',
['dist', 'version', 'dist:package:deb', 'install:deb', 'test', 'uninstall:deb']);
grunt.registerTask('test:rpm', 'Run tests against Red Hat package',
['download:rpm', 'install:rpm', 'test', 'uninstall:rpm']);
};