Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backout deprecation of value returned from suite; closes #3744 #3759

Merged
merged 1 commit into from Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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