<commit_before>"use strict";

const path = require('path');
const gulp = require('gulp');
const gutil = require('gulp-util');
const mochelec = require('gulp-mochelec');
const notifier = require('node-notifier');
const through = require('through2');
const livereload = require('livereload');

const TIMEOUT_PASS = 2000;
const TIMEOUT_FAIL = 4000;
const IMAGE_PASS = path.join(__dirname, 'img/pass.png');
const IMAGE_FAIL = path.join(__dirname, 'img/fail.png');

let args = require('minimist')(process.argv.slice(2));

// Command line arguments:
// `coverage`: generate code coverage from unit tests
// 'live': start livereload server watching coverage reports
// 'test-files': unit test files to run as glob patterns
// 'test-grep': grep pattern to filter unit tests

let files = {
	sources: ['index.js', 'lib/**/*.js'],
	tests: args['test-files'] || ['test/test-*.js'],
	live: ['coverage/'],
};

// start livereload server for coverage
if (args.live) {
		let lr = livereload.createServer({ delay: 500 });
		console.log('watching:', files.live);
		lr.watch(files.live);
}

function notifyFailure(err) {
	gutil.log("Failure: " + err.message);
	notifier.notify({
		'expire-time': TIMEOUT_FAIL,
		icon: IMAGE_FAIL,
		title: "Failed",
		message: err.message
	});
}

function notifyPass() {<commit_msg>Fix gulp task freezed after unit test failure<commit_after>"use strict";

const path = require('path');
const gulp = require('gulp');
const gutil = require('gulp-util');
const mochelec = require('gulp-mochelec');
const notifier = require('node-notifier');
const through = require('through2');
const livereload = require('livereload');

const TIMEOUT_PASS = 2000;
const TIMEOUT_FAIL = 4000;
const IMAGE_PASS = path.join(__dirname, 'img/pass.png');
const IMAGE_FAIL = path.join(__dirname, 'img/fail.png');

let args = require('minimist')(process.argv.slice(2));

// Command line arguments:
// `coverage`: generate code coverage from unit tests
// 'live': start livereload server watching coverage reports
// 'test-files': unit test files to run as glob patterns
// 'test-grep': grep pattern to filter unit tests

let files = {
	sources: ['index.js', 'lib/**/*.js'],
	tests: args['test-files'] || ['test/test-*.js'],
	live: ['coverage/'],
};

// start livereload server for coverage
if (args.live) {
		let lr = livereload.createServer({ delay: 500 });
		console.log('watching:', files.live);
		lr.watch(files.live);
}

function notifyFailure(err) {
	gutil.log("Failure: " + err.message);
	notifier.notify({
		'expire-time': TIMEOUT_FAIL,
		icon: IMAGE_FAIL,
		title: "Failed",
		message: err.message
	});
	this.emit('end');
}

function notifyPass() {
{'fraction_non_alphanumeric': 0.16874763526295877, 'fraction_numerical': 0.009837306091562617, 'mean_word_length': 4.941573033707865, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5032707', 'n_tokens_mistral': 906, 'n_tokens_neox': 855, 'n_words': 234}