11/* eslint no-console: 0 */
22
33import { deprecate } from '@ember/debug' ;
4- import Ember from 'ember' ;
54import { module } from 'qunit' ;
65import test from '../helpers/debug-test' ;
76
8- let originalWarn ;
7+ let originalWarn , originalConfig ;
98
109module ( 'deprecation collector' , function ( hooks ) {
1110 hooks . beforeEach ( function ( ) {
1211 originalWarn = console . warn ;
12+
13+ /*
14+ * Clear config for these tests
15+ */
16+ originalConfig = self . deprecationWorkflow . config ;
17+ self . deprecationWorkflow . config = null ;
1318 } ) ;
1419
1520 hooks . afterEach ( function ( ) {
16- Ember . ENV . RAISE_ON_DEPRECATION = false ;
17- self . deprecationWorkflow . config = null ;
21+ self . deprecationWorkflow . config = originalConfig ;
1822 self . deprecationWorkflow . deprecationLog = { messages : { } } ;
1923 console . warn = originalWarn ;
2024 } ) ;
@@ -45,16 +49,6 @@ self.deprecationWorkflow.config = {
4549 ) ;
4650 } ) ;
4751
48- test ( 'deprecation does not choke when called without soon-to-be-required options' , ( assert ) => {
49- deprecate ( 'silence-me' , undefined , {
50- id : 'silence-me' ,
51- since : 'the beginning' ,
52- until : 'forever' ,
53- for : 'testing' ,
54- } ) ;
55- assert . ok ( true , 'Deprecation did not raise' ) ;
56- } ) ;
57-
5852 test ( 'deprecations are not duplicated' , function ( assert ) {
5953 deprecate ( 'First deprecation' , false , {
6054 id : 'first' ,
@@ -99,8 +93,6 @@ self.deprecationWorkflow.config = {
9993 test ( 'specifying `throwOnUnhandled` as true raises' , function ( assert ) {
10094 assert . expect ( 2 ) ;
10195
102- Ember . ENV . RAISE_ON_DEPRECATION = false ;
103-
10496 self . deprecationWorkflow . config = {
10597 throwOnUnhandled : true ,
10698 workflow : [ { handler : 'silence' , matchMessage : 'Sshhhhh!!' } ] ,
@@ -131,8 +123,6 @@ self.deprecationWorkflow.config = {
131123 test ( 'specifying `throwOnUnhandled` as false does nothing' , function ( assert ) {
132124 assert . expect ( 1 ) ;
133125
134- Ember . ENV . RAISE_ON_DEPRECATION = false ;
135-
136126 self . deprecationWorkflow . config = {
137127 throwOnUnhandled : false ,
138128 } ;
@@ -147,7 +137,6 @@ self.deprecationWorkflow.config = {
147137 } ) ;
148138
149139 test ( 'deprecation silenced with string matcher' , ( assert ) => {
150- Ember . ENV . RAISE_ON_DEPRECATION = true ;
151140 self . deprecationWorkflow . config = {
152141 workflow : [ { matchMessage : 'Interesting' , handler : 'silence' } ] ,
153142 } ;
@@ -196,7 +185,6 @@ self.deprecationWorkflow.config = {
196185 } ) ;
197186
198187 test ( 'deprecation silenced with regex matcher' , ( assert ) => {
199- Ember . ENV . RAISE_ON_DEPRECATION = true ;
200188 self . deprecationWorkflow . config = {
201189 workflow : [ { matchMessage : / I n t e r / , handler : 'silence' } ] ,
202190 } ;
@@ -264,7 +252,6 @@ self.deprecationWorkflow.config = {
264252 } ) ;
265253
266254 test ( 'deprecation silenced with id matcher' , ( assert ) => {
267- Ember . ENV . RAISE_ON_DEPRECATION = true ;
268255 self . deprecationWorkflow . config = {
269256 workflow : [ { matchId : 'ember.deprecation-workflow' , handler : 'silence' } ] ,
270257 } ;
@@ -316,8 +303,6 @@ self.deprecationWorkflow.config = {
316303 test ( 'deprecation logging happens even if `throwOnUnhandled` is true' , function ( assert ) {
317304 assert . expect ( 2 ) ;
318305
319- Ember . ENV . RAISE_ON_DEPRECATION = false ;
320-
321306 self . deprecationWorkflow . config = {
322307 throwOnUnhandled : true ,
323308 } ;
0 commit comments