File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ class Runner extends EventEmitter {
138138 * @public
139139 * @class
140140 * @param {Suite } suite - Root suite
141- * @param {Object|boolean } [opts] - Options. If `boolean`, whether or not to delay execution of root suite until ready (for backwards compatibility) .
141+ * @param {Object|boolean } [opts] - Options. If `boolean` (deprecated) , whether or not to delay execution of root suite until ready.
142142 * @param {boolean } [opts.delay] - Whether to delay execution of root suite until ready.
143143 * @param {boolean } [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done.
144144 */
@@ -148,7 +148,10 @@ class Runner extends EventEmitter {
148148 opts = { } ;
149149 }
150150 if ( typeof opts === 'boolean' ) {
151- // TODO: deprecate this
151+ // TODO: remove this
152+ require ( './errors' ) . deprecate (
153+ '"Runner(suite: Suite, delay: boolean)" is deprecated. Use "Runner(suite: Suite, {delay: boolean})" instead.'
154+ ) ;
152155 this . _delay = opts ;
153156 opts = { } ;
154157 } else {
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const {
1111 MULTIPLE_DONE ,
1212 UNSUPPORTED
1313} = require ( '../../lib/errors' ) . constants ;
14+ const errors = require ( '../../lib/errors' ) ;
1415
1516const {
1617 EVENT_HOOK_BEGIN ,
@@ -32,6 +33,15 @@ describe('Runner', function() {
3233 sinon . restore ( ) ;
3334 } ) ;
3435
36+ describe ( 'constructor deprecation' , function ( ) {
37+ it ( 'should print a deprecation warning' , function ( ) {
38+ sinon . stub ( errors , 'deprecate' ) ;
39+ const suite = new Suite ( 'Suite' , 'root' ) ;
40+ new Runner ( suite , false ) ; /* eslint no-new: "off" */
41+ expect ( errors . deprecate , 'was called once' ) ;
42+ } ) ;
43+ } ) ;
44+
3545 describe ( 'instance method' , function ( ) {
3646 let suite ;
3747 let runner ;
You can’t perform that action at this time.
0 commit comments