@@ -134,7 +134,7 @@ interface ProjectCoverageConfig {
134134}
135135
136136export function searchOutputForFailures ( patterns : FailurePatternsConfig , output : string ) : vscode . TestMessage [ ] {
137- output = normalizeLF ( output ) ;
137+ output = util . normalizeLF ( output ) ;
138138 const messages = [ ] ;
139139 patterns = Array . isArray ( patterns ) ? patterns : [ patterns ] ;
140140 for ( let pattern of patterns ) {
@@ -163,7 +163,7 @@ function matchToTestMessage(pat: FailurePattern, match: RegExpMatchArray): vscod
163163 const actual = pat . actual ? match [ pat . actual ] : undefined ;
164164 const expected = pat . expected ? match [ pat . expected ] : undefined ;
165165
166- const testMessage = new vscode . TestMessage ( normalizeCRLF ( message ) ) ;
166+ const testMessage = new vscode . TestMessage ( util . normalizeCRLF ( message ) ) ;
167167 testMessage . location = new vscode . Location (
168168 vscode . Uri . file ( file ) , new vscode . Position ( line , 0 )
169169 ) ;
@@ -172,14 +172,6 @@ function matchToTestMessage(pat: FailurePattern, match: RegExpMatchArray): vscod
172172 return testMessage ;
173173}
174174
175- function normalizeLF ( s : string ) {
176- return s . replace ( / \r \n ? / g, '\n' ) ;
177- }
178-
179- function normalizeCRLF ( s : string ) {
180- return s = s . replace ( / \r ? \n / g, '\r\n' ) ;
181- }
182-
183175function parseLineMatch ( line : string | null ) {
184176 const i = parseInt ( line || '' ) ;
185177 if ( i ) {
@@ -661,7 +653,7 @@ export class CTestDriver implements vscode.Disposable {
661653
662654 let output = testResult . output ;
663655 // https://code.visualstudio.com/api/extension-guides/testing#test-output
664- output = output . replace ( / \r ? \n / g , '\r\n' ) ;
656+ output = util . normalizeCRLF ( output ) ;
665657 if ( test . uri && test . range ) {
666658 run . appendOutput ( output , new vscode . Location ( test . uri , test . range . end ) , test ) ;
667659 } else {
0 commit comments