Skip to content

Commit

Permalink
Revert 00ca06b; see #3414
Browse files Browse the repository at this point in the history
Updates events test to match correct event order
  • Loading branch information
boneskull committed Feb 4, 2019
1 parent e01a54e commit 596e591
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
9 changes: 2 additions & 7 deletions lib/runner.js
Expand Up @@ -857,15 +857,10 @@ Runner.prototype.run = function(fn) {
filterOnly(rootSuite);
}
self.started = true;
Runner.immediately(function() {
self.emit('start');
});

self.emit('start');
self.runSuite(rootSuite, function() {
debug('finished running');
Runner.immediately(function() {
self.emit('end');
});
self.emit('end');
});
}

Expand Down
4 changes: 2 additions & 2 deletions test/integration/fixtures/runner/events-bail.fixture.js
Expand Up @@ -3,14 +3,14 @@ var Runner = require('../../../../lib/runner.js');
var assert = require('assert');

var emitOrder = [
'suite'/* incorrect order*/, 'start', 'suite',
'start', 'suite', 'suite',
'hook', 'hook end', 'test', 'hook', 'hook end', 'fail', 'test end', 'hook', 'hook end',
'hook', 'hook end', 'suite end', 'suite end', 'end'
];

var realEmit = Runner.prototype.emit;
Runner.prototype.emit = function(event, ...args) {
// console.log(`emit: ${event}`);
// console.log(`emit: ${event}`);
assert.strictEqual(event, emitOrder.shift());
return realEmit.call(this, event, ...args);
};
Expand Down
3 changes: 1 addition & 2 deletions test/integration/fixtures/runner/events-basic.fixture.js
Expand Up @@ -3,15 +3,14 @@ var Runner = require('../../../../lib/runner.js');
var assert = require('assert');

var emitOrder = [
'suite'/* incorrect order*/, 'start', 'suite',
'start', 'suite', 'suite',
'hook', 'hook end', 'test', 'hook', 'hook end', 'pass', 'test end', 'hook', 'hook end',
'suite', 'test', 'hook', 'hook end', 'pass', 'test end', 'hook', 'hook end',
'suite end', 'hook', 'hook end', 'suite end', 'suite end', 'end'
];

var realEmit = Runner.prototype.emit;
Runner.prototype.emit = function(event, ...args) {
// console.log(`emit: ${event}`);
assert.strictEqual(event, emitOrder.shift());
return realEmit.call(this, event, ...args);
};
Expand Down
4 changes: 2 additions & 2 deletions test/integration/fixtures/runner/events-retries.fixture.js
Expand Up @@ -3,15 +3,15 @@ var Runner = require('../../../../lib/runner.js');
var assert = require('assert');

var emitOrder = [
'suite'/* incorrect order*/, 'start', 'suite',
'start', 'suite', 'suite',
'hook', 'hook end', 'test', 'hook', 'hook end', 'retry', 'hook', 'hook end',
'test', 'hook', 'hook end', 'fail', 'test end', 'hook', 'hook end', 'hook', 'hook end',
'suite end', 'suite end', 'end'
];

var realEmit = Runner.prototype.emit;
Runner.prototype.emit = function(event, ...args) {
// console.log(`emit: ${event}`);
// console.log(`emit: ${event}`);
assert.strictEqual(event, emitOrder.shift());
return realEmit.call(this, event, ...args);
};
Expand Down

0 comments on commit 596e591

Please sign in to comment.