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

Deprecate "new Runner(suite: Suite, delay: boolean)" #4646

Merged
merged 2 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
deprecate "new Runner(suite, delay: boolean)"
  • Loading branch information
juergba committed Jun 3, 2021
commit 913cb698359be36fc94f23f7dc87765522ca0c86
5 changes: 4 additions & 1 deletion lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ class Runner extends EventEmitter {
opts = {};
}
if (typeof opts === 'boolean') {
// TODO: deprecate this
// TODO: remove this
require('./errors').deprecate(
'"Runner(suite: Suite, delay: boolean)" is deprecated. Use "Runner(suite: Suite, {delay: boolean})" instead.'
);
this._delay = opts;
opts = {};
} else {
Expand Down
10 changes: 10 additions & 0 deletions test/unit/runner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
MULTIPLE_DONE,
UNSUPPORTED
} = require('../../lib/errors').constants;
const errors = require('../../lib/errors');

const {
EVENT_HOOK_BEGIN,
Expand All @@ -32,6 +33,15 @@ describe('Runner', function() {
sinon.restore();
});

describe('constructor deprecation', function() {
it('should print a deprecation warning', function() {
sinon.stub(errors, 'deprecate');
const suite = new Suite('Suite', 'root');
new Runner(suite, false); /* eslint no-new: "off" */
expect(errors.deprecate, 'was called once');
});
});

describe('instance method', function() {
let suite;
let runner;
Expand Down