-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
33 lines (28 loc) · 1 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
module.exports = function (grunt) {
const alternativePort = '9517'
grunt.initConfig({
chromedriver: {
quiet: {},
verbose: { verbose: true, args: [`--port=${alternativePort}`] },
otherPort: { port: +alternativePort, findAvailablePort: true },
fail: { args: ['--invalid'] }
},
nodeunit: {
started: ['test/started.js'],
stopped: ['test/stopped.js']
}
})
grunt.loadNpmTasks('grunt-contrib-nodeunit')
grunt.loadTasks('tasks')
process.env.CHROMEDRIVER_PORT = undefined
grunt.registerTask('switchPort', 'Grunt task switching the chromedriver port.', function () {
process.env.CHROMEDRIVER_PORT = alternativePort
})
grunt.registerTask('default', [
'nodeunit:stopped', 'chromedriver:quiet:start',
'nodeunit:started', 'chromedriver:quiet:stop',
'nodeunit:stopped', 'chromedriver:verbose:start', 'switchPort',
'nodeunit:started', 'chromedriver:verbose:stop', 'nodeunit:stopped',
'chromedriver:otherPort:start', 'nodeunit:started'
])
}