Skip to content

Commit

Permalink
add more Runner coverage for Coveralls
Browse files Browse the repository at this point in the history
- add my `unexpected-eventemitter` plugin, which helps test `EventEmitter` behavior
  • Loading branch information
boneskull committed Feb 6, 2019
1 parent 72a0cba commit 619ef49
Show file tree
Hide file tree
Showing 7 changed files with 335 additions and 13 deletions.
1 change: 1 addition & 0 deletions karma.conf.js
Expand Up @@ -156,6 +156,7 @@ module.exports = config => {
require.resolve('unexpected/unexpected'),
{pattern: require.resolve('unexpected/unexpected.js.map'), included: false},
require.resolve('unexpected-sinon'),
require.resolve('unexpected-eventemitter/dist/unexpected-eventemitter.js'),
require.resolve('./test/browser-specific/setup')
);

Expand Down
13 changes: 3 additions & 10 deletions lib/runner.js
Expand Up @@ -772,17 +772,9 @@ Runner.prototype.runSuite = function(suite, fn) {
*/
Runner.prototype.uncaught = function(err) {
if (err) {
debug(
'uncaught exception %s',
err ===
function() {
return this;
}.call(err)
? err.message || err
: err
);
debug('uncaught exception %O', err);
} else {
debug('uncaught undefined exception');
debug('uncaught undefined/falsy exception');
err = createInvalidExceptionError(
'Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger',
err
Expand Down Expand Up @@ -831,6 +823,7 @@ Runner.prototype.uncaught = function(err) {
this.hookUp(HOOK_TYPE_AFTER_EACH, this.next);
return;
}
debug(runnable);

// recover from hooks
var errSuite = this.suite;
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -560,6 +560,7 @@
"through2": "^3.0.0",
"to-vfile": "^5.0.2",
"unexpected": "^10.39.2",
"unexpected-eventemitter": "^1.1.3",
"unexpected-sinon": "^10.10.1",
"uslug": "^1.0.4",
"watchify": "^3.7.0"
Expand Down
3 changes: 2 additions & 1 deletion test/browser-specific/setup.js
Expand Up @@ -4,4 +4,5 @@ process.stdout = require('browser-stdout')();

global.expect = global.weknowhow.expect
.clone()
.use(global.weknowhow.unexpectedSinon);
.use(global.weknowhow.unexpectedSinon)
.use(global.unexpectedEventEmitter);
5 changes: 4 additions & 1 deletion test/setup.js
Expand Up @@ -2,5 +2,8 @@

var unexpected = require('unexpected');
global.expect = require('./assertions').mixinMochaAssertions(
unexpected.clone().use(require('unexpected-sinon'))
unexpected
.clone()
.use(require('unexpected-sinon'))
.use(require('unexpected-eventemitter'))
);

0 comments on commit 619ef49

Please sign in to comment.