Skip to content

Commit

Permalink
backout deprecation of value returned from suite; closes #3744
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Hiller <boneskull@boneskull.com>
  • Loading branch information
boneskull committed Feb 21, 2019
1 parent b7cfceb commit 7c9221d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
12 changes: 1 addition & 11 deletions lib/interfaces/common.js
@@ -1,7 +1,6 @@
'use strict';

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

Expand Down Expand Up @@ -138,16 +137,7 @@ module.exports = function(suites, context, mocha) {
}
}
if (typeof opts.fn === 'function') {
var result = opts.fn.call(suite);
if (typeof result !== 'undefined') {
utils.deprecate(
'Suites ignore return values. Suite "' +
suite.fullTitle() +
'" in ' +
suite.file +
' returned a value; this may be a bug in your test code'
);
}
opts.fn.call(suite);
suites.shift();
} else if (typeof opts.fn === 'undefined' && !suite.pending) {
throw createMissingArgumentError(
Expand Down
6 changes: 2 additions & 4 deletions test/integration/suite.spec.js
Expand Up @@ -51,17 +51,15 @@ describe('skipped suite w/ callback', function() {
});

describe('suite returning a value', function() {
it('should give a deprecation warning for suite callback returning a value', function(done) {
it('should not give a deprecation warning for suite callback returning a value', function(done) {
run(
'suite/suite-returning-value.fixture.js',
args,
function(err, res) {
if (err) {
return done(err);
}
var pattern = new RegExp('Suites ignore return values', 'g');
var result = res.output.match(pattern) || [];
expect(result, 'to have length', 1);
expect(res, 'not to contain output', /Suites ignore return values/);
done();
},
{stdio: 'pipe'}
Expand Down

0 comments on commit 7c9221d

Please sign in to comment.