@@ -33,16 +33,46 @@ 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 ( {
37+ message : 'Error 1' ,
38+ level : 'ERROR' ,
39+ stack_trace : `Error: msg\n${ ddFrame1 } ` ,
40+ errorType : 'Error'
41+ } ) ) . to . be . true
42+ expect ( logCollector . add ( {
43+ message : 'Error 1' ,
44+ level : 'ERROR' ,
45+ stack_trace : `Error: msg\n${ ddFrame2 } ` ,
46+ errorType : 'Error'
47+ } ) ) . to . be . true
48+ expect ( logCollector . add ( {
49+ message : 'Error 1' ,
50+ level : 'ERROR' ,
51+ stack_trace : `Error: msg\n${ ddFrame3 } ` ,
52+ errorType : 'Error'
53+ } ) ) . to . be . true
3954 } )
4055
4156 it ( 'should store logs with same message, same stack but different level' , ( ) => {
4257 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
58+ expect ( logCollector . add ( {
59+ message : 'Error 1' ,
60+ level : 'ERROR' ,
61+ stack_trace : `Error: msg\n${ ddFrame } ` ,
62+ errorType : 'Error'
63+ } ) ) . to . be . true
64+ expect ( logCollector . add ( {
65+ message : 'Error 1' ,
66+ level : 'WARN' ,
67+ stack_trace : `Error: msg\n${ ddFrame } ` ,
68+ errorType : 'Error'
69+ } ) ) . to . be . true
70+ expect ( logCollector . add ( {
71+ message : 'Error 1' ,
72+ level : 'DEBUG' ,
73+ stack_trace : `Error: msg\n${ ddFrame } ` ,
74+ errorType : 'Error'
75+ } ) ) . to . be . true
4676 } )
4777
4878 it ( 'should not store logs with empty stack and \'Generic Error\' message' , ( ) => {
@@ -109,7 +139,8 @@ describe('telemetry log collector', () => {
109139
110140 it ( 'should redact multi-line error messages' , ( ) => {
111141 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 } `
142+ const multiLineError = 'Error: Command failed: git rev-parse --abbrev-ref ' +
143+ `--symbolic-full-name @{upstream}${ EOL } fatal: HEAD does not point to a branch${ EOL } ${ EOL } ${ ddFrame } `
113144
114145 const ddFrames = multiLineError
115146 . split ( EOL )
0 commit comments