@@ -318,4 +318,76 @@ module('handleDeprecationWorkflow', function (hooks) {
318
318
) ;
319
319
} , 'deprecation throws' ) ;
320
320
} ) ;
321
+
322
+ test ( 'deprecation silenced with id regex' , function ( assert ) {
323
+ const config = {
324
+ throwOnUnhandled : true ,
325
+ workflow : [ { matchId : / ^ e m b e r \. .* / , handler : 'silence' } ] ,
326
+ } ;
327
+
328
+ handleDeprecationWorkflow (
329
+ config ,
330
+ 'Slightly interesting' ,
331
+ {
332
+ id : 'ember.deprecation-workflow' ,
333
+ since : 'the beginning' ,
334
+ until : '3.0.0' ,
335
+ for : 'testing' ,
336
+ } ,
337
+ ( ) => { } ,
338
+ ) ;
339
+
340
+ assert . ok ( true , 'Deprecation did not raise' ) ;
341
+ } ) ;
342
+
343
+ // eslint-disable-next-line qunit/require-expect
344
+ test ( 'deprecation logs with id regex' , function ( assert ) {
345
+ assert . expect ( 1 ) ;
346
+
347
+ let message = 'Slightly interesting' ;
348
+
349
+ console . warn = function ( passedMessage ) {
350
+ assert . strictEqual (
351
+ passedMessage ,
352
+ 'DEPRECATION: ' + message ,
353
+ 'deprecation logs' ,
354
+ ) ;
355
+ } ;
356
+
357
+ const config = {
358
+ throwOnUnhandled : true ,
359
+ workflow : [ { matchId : / ^ e m b e r \. .* / , handler : 'log' } ] ,
360
+ } ;
361
+
362
+ handleDeprecationWorkflow (
363
+ config ,
364
+ 'Slightly interesting' ,
365
+ {
366
+ id : 'ember.deprecation-workflow' ,
367
+ since : 'the beginning' ,
368
+ until : '3.0.0' ,
369
+ for : 'testing' ,
370
+ } ,
371
+ ( ) => { } ,
372
+ ) ;
373
+ } ) ;
374
+
375
+ test ( 'deprecation thrown with id regex' , function ( assert ) {
376
+ const config = {
377
+ workflow : [ { matchId : / ^ e m b e r \. .* / , handler : 'throw' } ] ,
378
+ } ;
379
+ assert . throws ( function ( ) {
380
+ handleDeprecationWorkflow (
381
+ config ,
382
+ 'Slightly interesting' ,
383
+ {
384
+ id : 'ember.deprecation-workflow' ,
385
+ since : 'the beginning' ,
386
+ until : '3.0.0' ,
387
+ for : 'testing' ,
388
+ } ,
389
+ ( ) => { } ,
390
+ ) ;
391
+ } , 'deprecation throws' ) ;
392
+ } ) ;
321
393
} ) ;
0 commit comments