@@ -33,16 +33,22 @@ describe('telemetry log collector', () => {
3333 const ddFrame1 = `at T (${ ddBasePath } path/to/dd/file1.js:1:2)`
3434 const ddFrame2 = `at T (${ ddBasePath } path/to/dd/file2.js:3:4)`
3535 const ddFrame3 = `at T (${ ddBasePath } path/to/dd/file3.js:5:6)`
36- expect ( logCollector . add ( { message : 'Error 1' , level : 'ERROR' , stack_trace : `Error: msg\n${ ddFrame1 } ` , errorType : 'Error' } ) ) . to . be . true
37- expect ( logCollector . add ( { message : 'Error 1' , level : 'ERROR' , stack_trace : `Error: msg\n${ ddFrame2 } ` , errorType : 'Error' } ) ) . to . be . true
38- expect ( logCollector . add ( { message : 'Error 1' , level : 'ERROR' , stack_trace : `Error: msg\n${ ddFrame3 } ` , errorType : 'Error' } ) ) . to . be . true
36+ expect ( logCollector . add ( { message : 'Error 1' , level : 'ERROR' ,
37+ stack_trace : `Error: msg\n${ ddFrame1 } ` , errorType : 'Error' } ) ) . to . be . true
38+ expect ( logCollector . add ( { message : 'Error 1' , level : 'ERROR' ,
39+ stack_trace : `Error: msg\n${ ddFrame2 } ` , errorType : 'Error' } ) ) . to . be . true
40+ expect ( logCollector . add ( { message : 'Error 1' , level : 'ERROR' ,
41+ stack_trace : `Error: msg\n${ ddFrame3 } ` , errorType : 'Error' } ) ) . to . be . true
3942 } )
4043
4144 it ( 'should store logs with same message, same stack but different level' , ( ) => {
4245 const ddFrame = `at T (${ ddBasePath } path/to/dd/file.js:1:2)`
43- expect ( logCollector . add ( { message : 'Error 1' , level : 'ERROR' , stack_trace : `Error: msg\n${ ddFrame } ` , errorType : 'Error' } ) ) . to . be . true
44- expect ( logCollector . add ( { message : 'Error 1' , level : 'WARN' , stack_trace : `Error: msg\n${ ddFrame } ` , errorType : 'Error' } ) ) . to . be . true
45- expect ( logCollector . add ( { message : 'Error 1' , level : 'DEBUG' , stack_trace : `Error: msg\n${ ddFrame } ` , errorType : 'Error' } ) ) . to . be . true
46+ expect ( logCollector . add ( { message : 'Error 1' , level : 'ERROR' ,
47+ stack_trace : `Error: msg\n${ ddFrame } ` , errorType : 'Error' } ) ) . to . be . true
48+ expect ( logCollector . add ( { message : 'Error 1' , level : 'WARN' ,
49+ stack_trace : `Error: msg\n${ ddFrame } ` , errorType : 'Error' } ) ) . to . be . true
50+ expect ( logCollector . add ( { message : 'Error 1' , level : 'DEBUG' ,
51+ stack_trace : `Error: msg\n${ ddFrame } ` , errorType : 'Error' } ) ) . to . be . true
4652 } )
4753
4854 it ( 'should not store logs with empty stack and \'Generic Error\' message' , ( ) => {
@@ -109,7 +115,8 @@ describe('telemetry log collector', () => {
109115
110116 it ( 'should redact multi-line error messages' , ( ) => {
111117 const ddFrame = `at cachedExec (${ ddBasePath } plugins/util/git-cache.js:96:17)`
112- const multiLineError = `Error: Command failed: git rev-parse --abbrev-ref --symbolic-full-name @{upstream}${ EOL } fatal: HEAD does not point to a branch${ EOL } ${ EOL } ${ ddFrame } `
118+ const multiLineError = 'Error: Command failed: git rev-parse --abbrev-ref '
119+ + `--symbolic-full-name @{upstream}${ EOL } fatal: HEAD does not point to a branch${ EOL } ${ EOL } ${ ddFrame } `
113120
114121 const ddFrames = multiLineError
115122 . split ( EOL )
0 commit comments