@@ -93,18 +93,33 @@ export const testing = async (
9393
9494export const typeDoc = async ( command : Command ) : Promise < StepResponse > => {
9595 const [ response , commandOutput ] = await runCommand ( command ) ;
96- let outputStr =
97- "<table><tr><th>File</th><th>Line</th><th>Column</th><th>Message</th></tr>" ;
98- outputStr += commandOutput . split ( "\n" ) . forEach ( ( line ) => {
99- console . log ( "line: " , line ) ;
100- let match = line . match ( / ( .* ) : ( \d + ) : ( \d + ) - ( .* ) / ) ;
101- console . log ( "match: " , match ) ;
102- if ( match ) {
103- const [ _ , filePath , line , column , message ] = match ;
104- return `<tr><td>${ filePath } </td><td>${ line } </td><td>${ column } </td><td>${ message } </td></tr>` ;
105- }
106- } ) ;
107- outputStr += "</table>" ;
96+ console . log ( "commandOutput: " , commandOutput ) ;
10897
109- return await buildComment ( response , outputStr , command . label ) ;
98+ if ( response . error ) {
99+ const lines = commandOutput . split ( "\n" ) ;
100+ const table = lines
101+ . map ( ( line ) => {
102+ const match = line . match ( / ^ ( .* ?) : ( \d + ) : ( \d + ) : ( .* ) $ / ) ;
103+ if ( match ) {
104+ const [ _ , file , line , column , message ] = match ;
105+ return `<tr><td>${ file } </td><td>${ line } </td><td>${ column } </td><td>${ message } </td></tr>` ;
106+ }
107+ return "" ;
108+ } )
109+ . join ( "" ) ;
110+ const outputStr = `<table><tr><th>File</th><th>Line</th><th>Column</th><th>Message</th></tr>${ table } </table>` ;
111+ return await buildComment ( response , outputStr , command . label ) ;
112+ }
113+ return await buildComment ( response , "" , command . label ) ;
114+
115+ // outputStr += commandOutput.split("\n").forEach((line) => {
116+ // console.log("line: ", line);
117+ // let match = line.match(/(.*):(\d+):(\d+) - (.*)/);
118+ // console.log("match: ", match);
119+ // if (match) {
120+ // const [_, filePath, line, column, message] = match;
121+ // return `<tr><td>${filePath}</td><td>${line}</td><td>${column}</td><td>${message}</td></tr>`;
122+ // }
123+ // });
124+ // outputStr += "</table>";
110125} ;
0 commit comments