<commit_before>'use strict';

var ENV = process.env;

var fs = require('fs');
if (fs.existsSync('./.env.json')) {
	var environmentOverrides = require('./.env.json');
	ENV = require('lodash').extend(ENV, environmentOverrides);
}


module.exports = function(grunt) {

	grunt.initConfig({
		"clean": {
			repo: ['polyfills/__repo'],
			versions: ['polyfills/__versions'],
			dist: ['polyfills/__dist']
		},
		"simplemocha": {
			options: {
				globals: ['should'],
				timeout: 5000,
				ignoreLeaks: false,
				ui: 'bdd',
				reporter: 'spec'
			},
			all: {
				src: ['test/node/**/*.js']
			}
		},
		"saucelabs": {
			compat: {
				options: {
					urls: {
						polyfilled: 'http://127.0.0.1:3000/test/director?mode=all',
						native: 'http://127.0.0.1:3000/test/director?mode=control'
					},
					browsers: browsers.full
				}
			},
			ci: {
				options: {
					cibuild: true,
					urls: {
						default: 'http://127.0.0.1:3000/test/director?mode=targeted'
					},
					browsers: browsers.ci
				}
			},
			quick: {
				options: {
					cibuild: true,
					urls: {
						default: 'http://127.0.0.1:3000/test/director?mode=targeted'
					},
					browsers: browsers.quick
				}
			}
		},
		"watch": {
			options: {
				spawn: false
			},
			js: {
				files: ['!*', 'docs/**/*', 'service/**/*', 'lib/**/*'],
				tasks: ['service:polyfillservice:restart']
			},
			polyfills: {
				files: ['!*', 'polyfills/**/*', '!polyfills/__versions/**', '!polyfills/*.json'],
				tasks: ['service:polyfillservice:stop', 'buildsources', 'service:polyfillservice:start']
			}
		},
		"service": {
			polyfillservice: {
				shellCommand: __dirname + '/bin/polyfill-service',
				pidFile: __dirname+'/.service.pid',
				generatePID: true,
				options: {
					env: ENV,
					cwd: __dirname,
					failOnError: true
				}
			}
		},
		"updatelibrary": {
			options: {
				expand: true
			},
			tasks: {
				src: ['polyfills/**/update.task.js'],
			}
		}
	});

	grunt.loadTasks('tasks');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-simple-mocha');

	grunt.registerTask("test", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:quick",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("compatgen", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:compat",
		"compattable",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("ci", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:ci",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("build", [
		"clean",
		"installcollections",
		"buildsources",
		"clean:repo",
		"clean:versions"
	]);

	grunt.registerTask('dev', [
		"clean",
		"buildsources",
		"service",
		"watch"
	]);
};

var browsers = {
	quick: [
		['chrome', '44', 'Windows 7'],
		['firefox', '39', 'Linux'],
		['internet explorer', '7', 'Windows XP'],
		['internet explorer', '11', 'Windows 10'],
	],
	ci: [
		['chrome', '44', 'Windows 7'],
		['chrome', '35', 'OSX 10.11'],
		['firefox', '39', 'Linux'],
		['firefox', '30', 'OSX 10.11'],
		['firefox', '3.6', 'Linux'],
		['internet explorer', '6', 'Windows XP'],
		['internet explorer', '7', 'Windows XP'],
		['internet explorer', '8', 'Windows XP'],
		['internet explorer', '9', 'Windows 7'],
		['internet explorer', '10', 'Windows 7'],
		['internet explorer', '11', 'Windows 10'],
		['safari', '5.1', 'Windows 7'],
		['safari', '8.1', 'OSX 10.11'],
		['android', '4.4', 'linux'],
		['android', '4.0', 'linux']
	],
	full: [
		['chrome', '44', 'Windows 7'],
		['chrome', '42', 'Windows 7'],
		['chrome', '35', 'OSX 10.11'],
		['chrome', '26', 'Windows 7'],
		['firefox', '39', 'Linux'],
		['firefox', '33', 'Linux'],
		['firefox', '30', 'OSX 10.11'],
		['firefox', '20', 'Linux'],
		['firefox', '3.6', 'Linux'],
		['internet explorer', '6', 'Windows XP'],
		['internet explorer', '7', 'Windows XP'],
		['internet explorer', '8', 'Windows XP'],
		['internet explorer', '9', 'Windows 7'],
		['internet explorer', '10', 'Windows 7'],
		['internet explorer', '11', 'Windows 10'],
		['safari', '5.1', 'Windows 7'],
		['safari', '8.1', 'OSX 10.11'],
		['android', '4.4', 'linux'],
		['android', '4.3', 'linux'],
		['android', '4.2', 'linux'],
		['android', '4.1', 'linux'],
		['android', '4.0', 'linux']
	]
};<commit_msg>Linux/FF3.6 is unreliable on Sauce<commit_after>'use strict';

var ENV = process.env;

var fs = require('fs');
if (fs.existsSync('./.env.json')) {
	var environmentOverrides = require('./.env.json');
	ENV = require('lodash').extend(ENV, environmentOverrides);
}


module.exports = function(grunt) {

	grunt.initConfig({
		"clean": {
			repo: ['polyfills/__repo'],
			versions: ['polyfills/__versions'],
			dist: ['polyfills/__dist']
		},
		"simplemocha": {
			options: {
				globals: ['should'],
				timeout: 5000,
				ignoreLeaks: false,
				ui: 'bdd',
				reporter: 'spec'
			},
			all: {
				src: ['test/node/**/*.js']
			}
		},
		"saucelabs": {
			compat: {
				options: {
					urls: {
						polyfilled: 'http://127.0.0.1:3000/test/director?mode=all',
						native: 'http://127.0.0.1:3000/test/director?mode=control'
					},
					browsers: browsers.full
				}
			},
			ci: {
				options: {
					cibuild: true,
					urls: {
						default: 'http://127.0.0.1:3000/test/director?mode=targeted'
					},
					browsers: browsers.ci
				}
			},
			quick: {
				options: {
					cibuild: true,
					urls: {
						default: 'http://127.0.0.1:3000/test/director?mode=targeted'
					},
					browsers: browsers.quick
				}
			}
		},
		"watch": {
			options: {
				spawn: false
			},
			js: {
				files: ['!*', 'docs/**/*', 'service/**/*', 'lib/**/*'],
				tasks: ['service:polyfillservice:restart']
			},
			polyfills: {
				files: ['!*', 'polyfills/**/*', '!polyfills/__versions/**', '!polyfills/*.json'],
				tasks: ['service:polyfillservice:stop', 'buildsources', 'service:polyfillservice:start']
			}
		},
		"service": {
			polyfillservice: {
				shellCommand: __dirname + '/bin/polyfill-service',
				pidFile: __dirname+'/.service.pid',
				generatePID: true,
				options: {
					env: ENV,
					cwd: __dirname,
					failOnError: true
				}
			}
		},
		"updatelibrary": {
			options: {
				expand: true
			},
			tasks: {
				src: ['polyfills/**/update.task.js'],
			}
		}
	});

	grunt.loadTasks('tasks');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-simple-mocha');

	grunt.registerTask("test", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:quick",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("compatgen", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:compat",
		"compattable",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("ci", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:ci",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("build", [
		"clean",
		"installcollections",
		"buildsources",
		"clean:repo",
		"clean:versions"
	]);

	grunt.registerTask('dev', [
		"clean",
		"buildsources",
		"service",
		"watch"
	]);
};

var browsers = {
	quick: [
		['chrome', '44', 'Windows 7'],
		['firefox', '39', 'Linux'],
		['internet explorer', '7', 'Windows XP'],
		['internet explorer', '11', 'Windows 10'],
	],
	ci: [
		['chrome', '44', 'Windows 7'],
		['chrome', '35', 'OSX 10.11'],
		['firefox', '39', 'Linux'],
		['firefox', '30', 'OSX 10.11'],
		['firefox', '3.6', 'Windows XP'],
		['internet explorer', '6', 'Windows XP'],
		['internet explorer', '7', 'Windows XP'],
		['internet explorer', '8', 'Windows XP'],
		['internet explorer', '9', 'Windows 7'],
		['internet explorer', '10', 'Windows 7'],
		['internet explorer', '11', 'Windows 10'],
		['safari', '5.1', 'Windows 7'],
		['safari', '8.1', 'OSX 10.11'],
		['android', '4.4', 'linux'],
		['android', '4.0', 'linux']
	],
	full: [
		['chrome', '44', 'Windows 7'],
		['chrome', '42', 'Windows 7'],
		['chrome', '35', 'OSX 10.11'],
		['chrome', '26', 'Windows 7'],
		['firefox', '39', 'Linux'],
		['firefox', '33', 'Linux'],
		['firefox', '30', 'OSX 10.11'],
		['firefox', '20', 'Linux'],
		['firefox', '3.6', 'Windows XP'],
		['internet explorer', '6', 'Windows XP'],
		['internet explorer', '7', 'Windows XP'],
		['internet explorer', '8', 'Windows XP'],
		['internet explorer', '9', 'Windows 7'],
		['internet explorer', '10', 'Windows 7'],
		['internet explorer', '11', 'Windows 10'],
		['safari', '5.1', 'Windows 7'],
		['safari', '8.1', 'OSX 10.11'],
		['android', '4.4', 'linux'],
		['android', '4.3', 'linux'],
		['android', '4.2', 'linux'],
		['android', '4.1', 'linux'],
		['android', '4.0', 'linux']
	]
};
{'fraction_non_alphanumeric': 0.24085472070607364, 'fraction_numerical': 0.03692950876785507, 'mean_word_length': 3.473766233766234, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, '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': '6145674', 'n_tokens_mistral': 4094, 'n_tokens_neox': 3275, 'n_words': 636}