1
1
'use strict' ;
2
- const exec = require ( 'child_process' ) . exec ;
3
2
const chai = require ( 'chai' ) ;
4
3
5
4
const expect = chai . expect ;
@@ -21,71 +20,6 @@ describe('Deprecation Warnings - functional', function () {
21
20
this . sinon . stub ( console , 'error' ) ;
22
21
} ) ;
23
22
24
- const defaultMessage = ' is deprecated and will be removed in a later version.' ;
25
- it . skip ( 'node --no-deprecation flag should suppress all deprecation warnings' , {
26
- metadata : { requires : { node : '>=6.0.0' } } ,
27
- test : function ( done ) {
28
- exec (
29
- 'node --no-deprecation ./test/tools/deprecate_warning_test_program.js' ,
30
- ( err , stdout , stderr ) => {
31
- expect ( err ) . to . not . exist ;
32
- expect ( stdout ) . to . be . empty ;
33
- expect ( stderr ) . to . be . empty ;
34
- done ( ) ;
35
- }
36
- ) ;
37
- }
38
- } ) ;
39
-
40
- it . skip ( 'node --trace-deprecation flag should print stack trace to stderr' , {
41
- metadata : { requires : { node : '>=6.0.0' } } ,
42
- test : function ( done ) {
43
- exec (
44
- 'node --trace-deprecation ./test/tools/deprecate_warning_test_program.js' ,
45
- ( err , stdout , stderr ) => {
46
- expect ( err ) . to . not . exist ;
47
- expect ( stdout ) . to . be . empty ;
48
- expect ( stderr ) . to . not . be . empty ;
49
-
50
- // split stderr into separate lines, trimming the first line to just the warning message
51
- const split = stderr . split ( '\n' ) ;
52
- const warning = split . shift ( ) . split ( ')' ) [ 1 ] . trim ( ) ;
53
-
54
- // ensure warning message matches expected
55
- expect ( warning ) . to . equal (
56
- 'DeprecationWarning: testDeprecationFlags option [maxScan]' + defaultMessage
57
- ) ;
58
-
59
- // ensure each following line is from the stack trace, i.e. 'at config.deprecatedOptions.forEach.deprecatedOption'
60
- split . pop ( ) ;
61
- split . forEach ( s => {
62
- expect ( s . trim ( ) ) . to . match ( / ^ a t / ) ;
63
- } ) ;
64
-
65
- done ( ) ;
66
- }
67
- ) ;
68
- }
69
- } ) ;
70
-
71
- it . skip ( 'node --throw-deprecation flag should throw error when deprecated function is called' , {
72
- metadata : { requires : { node : '>=6.0.0' } } ,
73
- test : function ( done ) {
74
- exec (
75
- 'node --throw-deprecation ./test/tools/deprecate_warning_test_program.js this_arg_should_never_print' ,
76
- ( err , stdout , stderr ) => {
77
- expect ( stderr ) . to . not . be . empty ;
78
- expect ( err ) . to . not . exist ;
79
- expect ( err ) . to . have . own . property ( 'code' ) . that . equals ( 1 ) ;
80
-
81
- // ensure stdout is empty, i.e. that the program threw an error before reaching the console.log statement
82
- expect ( stdout ) . to . be . empty ;
83
- done ( ) ;
84
- }
85
- ) ;
86
- }
87
- } ) ;
88
-
89
23
it ( 'test behavior for classes with an associated logger' , function ( ) {
90
24
const fakeClass = new ClassWithLogger ( ) ;
91
25
const logger = fakeClass . getLogger ( ) ;
0 commit comments