<commit_before>/*jslint node: true */
'use strict';

var through = require('through2');
var gutil = require('gulp-util');
var spawn = require('child_process').spawn;
var async = require('async');
var fs = require('fs-extra');
var path = require('path');
var freeport = require('freeport');
var httpServer = require('node-http-server');

var PLUGIN_NAME = 'gulp-nightwatch-headless';

var nightwatchBinary = [ "node_modules/nightwatch/bin/nightwatch", path.join( __dirname, "node_modules/nightwatch/bin/nightwatch" ) ];
var defaultSeleniumPath = [ "node_modules/selenium-server/lib/runner", path.join( __dirname, "node_modules/selenium-server/lib/runner" ) ];
var phantomJsBinary = [ "node_modules/phantomjs/bin/phantomjs", path.join( __dirname, "node_modules/phantomjs/bin/phantomjs" ) ];
var tempNightwatchDir = "temp";

// NOTE: These may change in future versions of selenium & phantom
var seleniumStartedRegex = new RegExp( "INFO\\:osjs\\.AbstractConnector\\:Started\\s+SocketConnector" );
var phantomStartedRegex = new RegExp( "HUB\\s+Register\\s+\\-\\s+register\\s+\\-\\s+Registered\\s+with\\s+grid\\s+hub(.*?)\\s+\\(ok\\)" );


var testAutomation = function( options ) {
	options = options || {};

	var subProcesses = [];

	var seleniumPort = 0;
	var httpServerPort = 0;

	var totalOutput = '';
	var httpServerInstance = null;

	var pickExisting = function( arr ) {
		for ( var i=0; i<arr.length; ++i ) {
			if ( fs.existsSync( arr[i] ) ) {
				return arr[i];<commit_msg>Fix Selenium start detection regex<commit_after>/*jslint node: true */
'use strict';

var through = require('through2');
var gutil = require('gulp-util');
var spawn = require('child_process').spawn;
var async = require('async');
var fs = require('fs-extra');
var path = require('path');
var freeport = require('freeport');
var httpServer = require('node-http-server');

var PLUGIN_NAME = 'gulp-nightwatch-headless';

var nightwatchBinary = [ "node_modules/nightwatch/bin/nightwatch", path.join( __dirname, "node_modules/nightwatch/bin/nightwatch" ) ];
var defaultSeleniumPath = [ "node_modules/selenium-server/lib/runner", path.join( __dirname, "node_modules/selenium-server/lib/runner" ) ];
var phantomJsBinary = [ "node_modules/phantomjs/bin/phantomjs", path.join( __dirname, "node_modules/phantomjs/bin/phantomjs" ) ];
var tempNightwatchDir = "temp";

// NOTE: These may change in future versions of selenium & phantom
var seleniumStartedRegex = new RegExp( "INFO\\:osjs\\.ServerConnector\\:\\.+Started\\s+ServerConnector" );
var phantomStartedRegex = new RegExp( "HUB\\s+Register\\s+\\-\\s+register\\s+\\-\\s+Registered\\s+with\\s+grid\\s+hub(.*?)\\s+\\(ok\\)" );


var testAutomation = function( options ) {
	options = options || {};

	var subProcesses = [];

	var seleniumPort = 0;
	var httpServerPort = 0;

	var totalOutput = '';
	var httpServerInstance = null;

	var pickExisting = function( arr ) {
		for ( var i=0; i<arr.length; ++i ) {
			if ( fs.existsSync( arr[i] ) ) {
				return arr[i];
{'fraction_non_alphanumeric': 0.17186975495132595, 'fraction_numerical': 0.002685464921114468, 'mean_word_length': 4.708812260536399, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2687527', 'n_tokens_mistral': 1048, 'n_tokens_neox': 987, 'n_words': 215}