<commit_before>var EventEmitter = require('events').EventEmitter;


var Watai		= require('../helpers/subject'),
	config		= require('../config'),
	stdoutSpy	= require('../helpers/StdoutSpy');


/** A simple Feature stub, to have proper parameters to pass to events.
*/
var feature = new Watai.Feature('Test feature', [], {}, require('../config'));


/** The views to test.
*/
var views = [
		'Runner/CLI',
		'Runner/Dots',
		'Runner/Flow',
		'Runner/Instafail'
	],
/** Event names mapped to the parameters expected by the event.
*/
	events = [ 'driverInit', 'start' ];



/** This test suite is written with [Mocha](http://visionmedia.github.com/mocha/) and [Should](https://github.com/visionmedia/should.js).
*/
describe('Views', function() {
	var emitter;

	before(function() {
		config.quit = 'always';
		emitter = new Watai.Runner(config);
		emitter.test();
	});

	views.forEach(function(view) {
		var subject;

		describe(view, function() {
			it('should exist', function() {
				(function() {
					var subjectClass = require(Watai.path + '/view/' + view);
					subject = new subjectClass(emitter);
				}).should.not.throw();
			});

			events.each(function(eventName) {
				describe(eventName + ' event', function() {
					before(function() {
						stdoutSpy.reset();
					});

					it('should output something', function() {
						stdoutSpy.mute();
						emitter.emit(eventName);
						stdoutSpy.unmute();
						stdoutSpy.called().should.be.true;
					});

					after(function() {
						stdoutSpy.unmute();	// keep it in the `after` handler just in case something goes wrong in the test
					});
				});
			});
		});
	});
});
<commit_msg>Update ViewsTest to properly quit driver with WD library<commit_after>var EventEmitter = require('events').EventEmitter;


var Watai		= require('../helpers/subject'),
	config		= require('../config'),
	stdoutSpy	= require('../helpers/StdoutSpy');


/** A simple Feature stub, to have proper parameters to pass to events.
*/
var feature = new Watai.Feature('Test feature', [], {}, require('../config'));


/** The views to test.
*/
var views = [
		'Runner/CLI',
		'Runner/Dots',
		'Runner/Flow',
		'Runner/Instafail'
	],
/** Event names mapped to the parameters expected by the event.
*/
	events = [ 'driverInit', 'start' ];



/** This test suite is written with [Mocha](http://visionmedia.github.com/mocha/) and [Should](https://github.com/visionmedia/should.js).
*/
describe('Views', function() {
	var emitter;

	before(function(done) {
		this.timeout(config.browserWarmupTime);

		config.quit = 'always';
		emitter = new Watai.Runner(config);
		emitter.test().done(function() { done() });
	});

	views.forEach(function(view) {
		var subject;

		describe(view, function() {
			it('should exist', function() {
				(function() {
					var subjectClass = require(Watai.path + '/view/' + view);
					subject = new subjectClass(emitter);
				}).should.not.throw();
			});

			events.each(function(eventName) {
				describe(eventName + ' event', function() {
					before(function() {
						stdoutSpy.reset();
					});

					it('should output something', function() {
						stdoutSpy.mute();
						emitter.emit(eventName);
						stdoutSpy.unmute();
						stdoutSpy.called().should.be.true;
					});

					after(function() {
						stdoutSpy.unmute();	// keep it in the `after` handler just in case something goes wrong in the test
					});
				});
			});
		});
	});
});

{'fraction_non_alphanumeric': 0.17733411626541398, 'fraction_numerical': 0.0, 'mean_word_length': 3.296343001261034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2935908', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1065, 'n_words': 250}