Skip to content

Commit

Permalink
Merge 76fa998 into 00f2ed9
Browse files Browse the repository at this point in the history
  • Loading branch information
plroebuck committed Feb 21, 2019
2 parents 00f2ed9 + 76fa998 commit 10da2d9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/cli/run-option-metadata.js
Expand Up @@ -35,6 +35,7 @@ exports.types = {
'forbid-pending',
'full-trace',
'growl',
'implicit-returns',
'inline-diffs',
'interfaces',
'invert',
Expand Down
4 changes: 4 additions & 0 deletions lib/cli/run.js
Expand Up @@ -143,6 +143,10 @@ exports.builder = yargs =>
description: 'Enable Growl notifications',
group: GROUPS.OUTPUT
},
'implicit-returns': {
description: 'Denote source language uses implicit returns',
group: GROUPS.RULES
},
'inline-diffs': {
description:
'Display actual/expected differences inline within each string',
Expand Down
15 changes: 9 additions & 6 deletions lib/interfaces/common.js
@@ -1,9 +1,11 @@
'use strict';

var util = require('util');
var Suite = require('../suite');
var utils = require('../utils');
var errors = require('../errors');
var createMissingArgumentError = errors.createMissingArgumentError;
var dQuote = utils.dQuote;

/**
* Functions common to more than one interface.
Expand Down Expand Up @@ -139,13 +141,14 @@ module.exports = function(suites, context, mocha) {
}
if (typeof opts.fn === 'function') {
var result = opts.fn.call(suite);
if (typeof result !== 'undefined') {
if (typeof result !== 'undefined' && !mocha.options.implicitReturns) {
utils.deprecate(
'Suites ignore return values. Suite "' +
suite.fullTitle() +
'" in ' +
suite.file +
' returned a value; this may be a bug in your test code'
util.format(
'Suites ignore return values. Suite %s in %s returned a value; ' +
'this may be a bug in your test code',
dQuote(suite.fullTitle()),
dQuote(suite.file)
)
);
}
suites.shift();
Expand Down
1 change: 1 addition & 0 deletions lib/mocha.js
Expand Up @@ -81,6 +81,7 @@ exports.Test = require('./test');
* @param {boolean} [options.growl] - Enable desktop notifications?
* @param {boolean} [options.hideDiff] - Suppress diffs from failures?
* @param {boolean} [options.ignoreLeaks] - Ignore global leaks?
* @param {boolean} [options.implicitReturns] - Language uses implicit returns?
* @param {boolean} [options.invert] - Invert test filter matches?
* @param {boolean} [options.noHighlighting] - Disable syntax highlighting?
* @param {string} [options.reporter] - Reporter name.
Expand Down

0 comments on commit 10da2d9

Please sign in to comment.