@@ -88,18 +88,29 @@ private void ProcessTestRunnerEmit(string line)
8888 {
8989 TestEvent testEvent = JsonConvert . DeserializeObject < TestEvent > ( line ) ;
9090 // Extract test from list of tests
91- var test = _currentTests . Where ( n => n . DisplayName == testEvent . title ) ;
92- if ( test . Count ( ) > 0 )
91+ var tests = _currentTests . Where ( n => n . DisplayName == testEvent . title ) ;
92+ if ( tests . Count ( ) > 0 )
9393 {
94- if ( testEvent . type == "test start" )
94+ switch ( testEvent . type )
9595 {
96- _currentResult = new TestResult ( test . First ( ) ) ;
97- _currentResult . StartTime = DateTimeOffset . Now ;
98- _frameworkHandle . RecordStart ( test . First ( ) ) ;
99- }
100- else if ( testEvent . type == "result" )
101- {
102- RecordEnd ( _frameworkHandle , test . First ( ) , _currentResult , testEvent . result ) ;
96+ case "test start" :
97+ {
98+ _currentResult = new TestResult ( tests . First ( ) ) ;
99+ _currentResult . StartTime = DateTimeOffset . Now ;
100+ _frameworkHandle . RecordStart ( tests . First ( ) ) ;
101+ }
102+ break ;
103+ case "result" :
104+ {
105+ RecordEnd ( _frameworkHandle , tests . First ( ) , _currentResult , testEvent . result ) ;
106+ }
107+ break ;
108+ case "pending" :
109+ {
110+ _currentResult = new TestResult ( tests . First ( ) ) ;
111+ RecordEnd ( _frameworkHandle , tests . First ( ) , _currentResult , testEvent . result ) ;
112+ }
113+ break ;
103114 }
104115 }
105116 else if ( testEvent . type == "suite end" )
@@ -345,9 +356,17 @@ private NodejsProjectSettings LoadProjectSettings(string projectFile) {
345356 private void RecordEnd ( IFrameworkHandle frameworkHandle , TestCase test , TestResult result , ResultObject resultObject ) {
346357 String [ ] standardOutputLines = resultObject . stdout . Split ( '\n ' ) ;
347358 String [ ] standardErrorLines = resultObject . stderr . Split ( '\n ' ) ;
348- result . EndTime = DateTimeOffset . Now ;
349- result . Duration = result . EndTime - result . StartTime ;
350- result . Outcome = resultObject . passed ? TestOutcome . Passed : TestOutcome . Failed ;
359+
360+ if ( null != resultObject . pending && ( bool ) resultObject . pending )
361+ {
362+ result . Outcome = TestOutcome . Skipped ;
363+ }
364+ else
365+ {
366+ result . EndTime = DateTimeOffset . Now ;
367+ result . Duration = result . EndTime - result . StartTime ;
368+ result . Outcome = resultObject . passed ? TestOutcome . Passed : TestOutcome . Failed ;
369+ }
351370 result . Messages . Add ( new TestResultMessage ( TestResultMessage . StandardOutCategory , String . Join ( Environment . NewLine , standardOutputLines ) ) ) ;
352371 result . Messages . Add ( new TestResultMessage ( TestResultMessage . StandardErrorCategory , String . Join ( Environment . NewLine , standardErrorLines ) ) ) ;
353372 result . Messages . Add ( new TestResultMessage ( TestResultMessage . AdditionalInfoCategory , String . Join ( Environment . NewLine , standardErrorLines ) ) ) ;
@@ -397,11 +416,13 @@ class ResultObject {
397416 public ResultObject ( ) {
398417 title = String . Empty ;
399418 passed = false ;
419+ pending = false ;
400420 stdout = String . Empty ;
401421 stderr = String . Empty ;
402422 }
403423 public string title { get ; set ; }
404424 public bool passed { get ; set ; }
425+ public bool ? pending { get ; set ; }
405426 public string stdout { get ; set ; }
406427 public string stderr { get ; set ; }
407428}
0 commit comments