import fs = require ( 'fs' ) ; import iconv = require ( 'iconv-lite' ) ; export class TestUtils { static getLine ( stdout , start ) { const startIndex = stdout . indexOf ( start ) ; const endIndex = stdout . indexOf ( '\n' , startIndex ) ; return stdout . substring ( startIndex , endIndex ) ; } static getAssemblyInfoValue ( filePath , propertyName ) { let value = '' ; const fileContent = iconv . decode ( fs . readFileSync ( filePath ) , 'utf-8' ) ; let result = fileContent . match ( new RegExp ( `${ propertyName }\\s*\\w*\\(".*"\\)` , 'gi' ) ) as RegExpMatchArray ; if ( ! result ) { return value ; } if ( result . length === 1 ) { return this . getValue ( result [ 0 ] ) ; } return this . getValue ( result [ result . length - 1 ] ) ; } private static getValue ( property ) { return property . substring ( property . indexOf ( '("' ) + 2 , property . indexOf ( '")' ) ) ; } }