@@ -8,6 +8,7 @@ import {StyleType} from '../reporter';
88import { styling } from '../reporter/Style' ;
99import { SuiteResult } from '../reporter/Results' ;
1010import { Reporter } from '../reporter/Reporter' ;
11+ import { Outcome } from "../reporter/describers/Describer" ;
1112
1213interface DependenceTree {
1314 test : TestScenario ;
@@ -104,7 +105,9 @@ export class Framework {
104105 } ) ) )
105106 }
106107
107- public async run ( suites : Suite [ ] ) {
108+ public async run ( suites : Suite [ ] ) : Promise < boolean > {
109+ let success : boolean = true ;
110+
108111 this . scheduled . concat ( suites ) ;
109112 this . reporter . general ( ) ;
110113 const t0 = performance . now ( ) ;
@@ -118,6 +121,7 @@ export class Framework {
118121
119122 await this . runSuite ( result , testee , order ) ;
120123 this . reporter . report ( result ) ;
124+ success = success && result . outcome === Outcome . succeeded ;
121125 } ) )
122126 } ) )
123127 const t1 = performance . now ( ) ;
@@ -126,6 +130,8 @@ export class Framework {
126130 await Promise . all ( suites . map ( suite => suite . testees . map ( async ( testee : Testee ) => {
127131 await timeout < Object | void > ( 'Shutdown testbed' , testee . timeout , testee . shutdown ( ) ) ;
128132 } ) ) )
133+
134+ return success ;
129135 }
130136
131137 public async parallel ( suites : Suite [ ] ) {
@@ -162,10 +168,9 @@ export class Framework {
162168 }
163169 }
164170
165- // Analyse flakiness
166- public analyse ( suite : Suite [ ] , runs : number = 3 ) {
171+ public analyse ( suite : Suite [ ] , runs : number = 1 ) {
167172 this . runs = runs ;
168- this . run ( suite ) ;
173+ this . run ( suite ) . then ( ( success : boolean ) => process . exit ( success ? 0 : 1 ) ) ;
169174 }
170175
171176 public static getImplementation ( ) {
0 commit comments