-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Updates events test to match correct event order - Add test for retries-and-bail case - Split `--invert` test case into its own file
- Loading branch information
Showing
12 changed files
with
165 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
test/integration/fixtures/runner/events-bail-retries.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use strict'; | ||
var Runner = require('../../../../lib/runner.js'); | ||
var assert = require('assert'); | ||
var constants = Runner.constants; | ||
var EVENT_HOOK_BEGIN = constants.EVENT_HOOK_BEGIN; | ||
var EVENT_HOOK_END = constants.EVENT_HOOK_END; | ||
var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN; | ||
var EVENT_RUN_END = constants.EVENT_RUN_END; | ||
var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN; | ||
var EVENT_SUITE_END = constants.EVENT_SUITE_END; | ||
var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN; | ||
var EVENT_TEST_END = constants.EVENT_TEST_END; | ||
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL; | ||
var EVENT_TEST_RETRY = constants.EVENT_TEST_RETRY; | ||
|
||
var emitOrder = [ | ||
EVENT_RUN_BEGIN, | ||
EVENT_SUITE_BEGIN, | ||
EVENT_SUITE_BEGIN, | ||
EVENT_HOOK_BEGIN, | ||
EVENT_HOOK_END, | ||
EVENT_TEST_BEGIN, | ||
EVENT_HOOK_BEGIN, | ||
EVENT_HOOK_END, | ||
EVENT_TEST_RETRY, | ||
EVENT_HOOK_BEGIN, | ||
EVENT_HOOK_END, | ||
EVENT_TEST_BEGIN, | ||
EVENT_HOOK_BEGIN, | ||
EVENT_HOOK_END, | ||
EVENT_TEST_FAIL, | ||
EVENT_TEST_END, | ||
EVENT_HOOK_BEGIN, | ||
EVENT_HOOK_END, | ||
EVENT_HOOK_BEGIN, | ||
EVENT_HOOK_END, | ||
EVENT_SUITE_END, | ||
EVENT_SUITE_END, | ||
EVENT_RUN_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); | ||
}; | ||
|
||
describe('suite A', function() { | ||
before('before', function() {}); | ||
beforeEach('beforeEach', function() {}); | ||
it('test A', function() { | ||
throw new Error('error test A'); | ||
}); | ||
afterEach('afterEach', function() {}); | ||
after('after', function() {}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
var runMocha = require('../helpers').runMocha; | ||
|
||
describe('--invert', function() { | ||
describe('when used without --fgrep or --grep', function() { | ||
it('it should report an error', function(done) { | ||
runMocha( | ||
'options/grep', | ||
['--invert'], | ||
function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
expect( | ||
res, | ||
'to have failed with output', | ||
/--invert.*--grep <regexp>/ | ||
); | ||
done(); | ||
}, | ||
'pipe' | ||
); | ||
}); | ||
}); | ||
}); |