@@ -23,6 +23,7 @@ module.exports = function (context) {
23
23
. inject ( { current : dataRow . data } ) ) ;
24
24
}
25
25
} ) ;
26
+ maskSecretInTitle ( scenarios ) ;
26
27
return new DataScenarioConfig ( scenarios ) ;
27
28
} ,
28
29
only : {
@@ -42,6 +43,7 @@ module.exports = function (context) {
42
43
. inject ( { current : dataRow . data } ) ) ;
43
44
}
44
45
} ) ;
46
+ maskSecretInTitle ( scenarios ) ;
45
47
return new DataScenarioConfig ( scenarios ) ;
46
48
} ,
47
49
} ,
@@ -71,12 +73,6 @@ function replaceTitle(title, dataRow) {
71
73
// it should be printed
72
74
if ( Object . prototype . toString . call ( dataRow . data ) === ( Object ( ) ) . toString ( )
73
75
&& dataRow . data . toString ( ) !== ( Object ( ) ) . toString ( ) ) {
74
- Object . entries ( dataRow . data ) . forEach ( entry => {
75
- const [ key , value ] = entry ;
76
- if ( value instanceof Secret ) {
77
- dataRow . data [ key ] = value . getMasked ( ) ;
78
- }
79
- } ) ;
80
76
return `${ title } | ${ dataRow . data } ` ;
81
77
}
82
78
@@ -119,3 +115,15 @@ function detectDataType(dataTable) {
119
115
120
116
throw new Error ( 'Invalid data type. Data accepts either: DataTable || generator || Array || function' ) ;
121
117
}
118
+
119
+ function maskSecretInTitle ( scenarios ) {
120
+ scenarios . forEach ( scenario => {
121
+ const res = [ ] ;
122
+
123
+ scenario . test . title . split ( ',' ) . forEach ( item => {
124
+ res . push ( item . replace ( / { " _ s e c r e t " : " ( .* ) " } / , '"*****"' ) ) ;
125
+ } ) ;
126
+
127
+ scenario . test . title = res . join ( ',' ) ;
128
+ } ) ;
129
+ }
0 commit comments