First, install gulp-nightwatch
as a development dependency:
npm install --save-dev gulp-nightwatch
Then, write your gulpfile.js as below.
var gulp = require('gulp'),
nightwatch = require('gulp-nightwatch');
gulp.task('default', function() {
return gulp.src('')
.pipe(nightwatch({
configFile: 'test/nightwatch.json'
}));
});
You can pass command line options to Nightwatch as an array by using the option cliArgs
.
gulp.task('nightwatch:chrome', function(){
return gulp.src('')
.pipe(nightwatch({
configFile: 'test/nightwatch.json',
cliArgs: [ '--env chrome', '--tag sandbox' ]
}));
});
You may use an object instead, if you prefer.
gulp.task('nightwatch:chrome', function(){
return gulp.src('')
.pipe(nightwatch({
configFile: 'test/nightwatch.json',
cliArgs: {
env: 'chrome',
tag: 'sandbox'
}
}));
});
Type: String
Default: nightwatch.json
The path to your Nightwatch config
Type: Array
or Object
Default: null
Command line options for Nightwatch