gulp/index.js
function (tests) {
            return new Promise(function (resolve) {
                var visual = argv && argv.visual;
                var visualPort = argv && argv.visualPort || '8002';
                var params = ['test', '--web-security=no', '--server-port=' + serverPort];

                if (visual) {
                    params.push('--visual=' + (visual || 10));
                    params.push('--visual-port=' + visualPort);
                }
                var casperChild = spawn(
                    pathToCasper,
                    params.concat(tests)
                );

                casperChild.stdout.on('data', function (data) {
                    logger('CasperJS:', data.toString().slice(0, -1));
                });

                casperChild.on('close', function (code) {
                    resolve(code);
                });
            });
        }
function (tests) {
            return new Promise(function (resolve) {
                var visual = argv && argv.visual;
                var visualPort = argv && argv.visualPort || '8002';
                var params = ['test', '--web-security=no', '--server-port=' + serverPort];

                if (visual) {
                    params.push('--visual=' + (visual || 10));
                    params.push('--visual-port=' + visualPort);
                }
                var casperChild = spawn(
                    pathToCasper,
                    params.concat(tests)
                );

                casperChild.stdout.on('data', function (data) {
                    logger('CasperJS:', data.toString().slice(0, -1));
                });

                casperChild.on('close', function (code) {
                    resolve(code);
                });
            });
        }
function ( tests ) { return new Promise ( function ( resolve ) { var visual = argv && argv . visual ; var visualPort = argv && argv . visualPort || '8002' ; var params = [ 'test' , '--web-security=no' , '--server-port=' + serverPort ] ; if ( visual ) { params . push ( '--visual=' + ( visual || 10 ) ) ; params . push ( '--visual-port=' + visualPort ) ; } var casperChild = spawn ( pathToCasper , params . concat ( tests ) ) ; casperChild . stdout . on ( 'data' , function ( data ) { logger ( 'CasperJS:' , data . toString ( ) . slice ( 0 , - 1 ) ) ; } ) ; casperChild . on ( 'close' , function ( code ) { resolve ( code ) ; } ) ; } ) ; }
Runs casperjs process with tests passed as arguments to it and logs output.

@method runTests
@param {String[]} tests paths to tests
@returns {Promise} resolves with casper exit code (0 or 1)
Runs casperjs process with tests passed as arguments to it and logs output .