File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed
src/client/testing/common Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -70,23 +70,25 @@ export class XUnitParser implements IXUnitParser {
7070 // Un-comment this line to capture the results file for later use in tests:
7171 //await fs.writeFile('/tmp/results.xml', data);
7272
73- // tslint:disable-next-line:no-require-imports
74- const xml2js = require ( 'xml2js' ) ;
73+ const parserResult = await parseXML ( data ) as { testsuite : TestSuiteResult } ;
74+ updateTests ( tests , parserResult . testsuite ) ;
75+ }
76+ }
77+
78+ // tslint:disable-next-line:no-any
79+ async function parseXML ( data : string ) : Promise < any > {
80+ // tslint:disable-next-line:no-require-imports
81+ const xml2js = require ( 'xml2js' ) ;
82+ // tslint:disable-next-line:no-any
83+ return new Promise < any > ( ( resolve , reject ) => {
7584 // tslint:disable-next-line:no-any
76- await new Promise < any > ( ( resolve , reject ) => {
77- xml2js . parseString ( data , ( error : Error , parserResult : { testsuite : TestSuiteResult } ) => {
78- if ( error ) {
79- return reject ( error ) ;
80- }
81- try {
82- updateTests ( tests , parserResult . testsuite ) ;
83- } catch ( err ) {
84- return reject ( err ) ;
85- }
86- return resolve ( ) ;
87- } ) ;
85+ xml2js . parseString ( data , ( error : Error , result : any ) => {
86+ if ( error ) {
87+ return reject ( error ) ;
88+ }
89+ return resolve ( result ) ;
8890 } ) ;
89- }
91+ } ) ;
9092}
9193
9294// Set the number of passing tests given the total number.
You can’t perform that action at this time.
0 commit comments