@@ -17,17 +17,50 @@ class MainBenchmarkClient {
1717 _hasResults = false ;
1818 _developerModeContainer = null ;
1919 _metrics = Object . create ( null ) ;
20+ _steppingPromise = null ;
21+ _steppingResolver = null ;
2022
2123 constructor ( ) {
2224 window . addEventListener ( "DOMContentLoaded" , ( ) => this . prepareUI ( ) ) ;
2325 this . _showSection ( window . location . hash ) ;
2426 }
2527
2628 start ( ) {
27- if ( this . _startBenchmark ( ) )
29+ if ( this . _isStepping ( ) )
30+ this . _clearStepping ( ) ;
31+ else if ( this . _startBenchmark ( ) )
2832 this . _showSection ( "#running" ) ;
2933 }
3034
35+ step ( ) {
36+ const currentSteppingResolver = this . _steppingResolver ;
37+ this . _steppingPromise = new Promise ( ( resolve ) => {
38+ this . _steppingResolver = resolve ;
39+ } ) ;
40+ if ( this . _isStepping ( ) )
41+ currentSteppingResolver ( ) ;
42+ if ( ! this . _isRunning ) {
43+ this . _startBenchmark ( ) ;
44+ this . _showSection ( "#running" ) ;
45+ }
46+ }
47+
48+ _clearStepping ( ) {
49+ const currentSteppingResolver = this . _steppingResolver ;
50+ this . _steppingPromise = null ;
51+ this . _steppingResolver = null ;
52+ currentSteppingResolver ( ) ;
53+ }
54+
55+ async _awaitNextStep ( suite , test ) {
56+ console . log ( `Next Step: ${ suite . name } ${ test . name } ` , { suite, test } ) ;
57+ await this . _steppingPromise ;
58+ }
59+
60+ _isStepping ( ) {
61+ return this . _steppingResolver !== null ;
62+ }
63+
3164 _startBenchmark ( ) {
3265 if ( this . _isRunning )
3366 return false ;
@@ -44,8 +77,8 @@ class MainBenchmarkClient {
4477
4578 return false ;
4679 }
47-
48- this . _developerModeContainer ?. remove ( ) ;
80+ if ( ! this . _isStepping ( ) )
81+ this . _developerModeContainer ?. remove ( ) ;
4982 this . _progressCompleted = document . getElementById ( "progress-completed" ) ;
5083 if ( params . iterationCount < 50 ) {
5184 const progressNode = document . getElementById ( "progress" ) ;
@@ -81,9 +114,11 @@ class MainBenchmarkClient {
81114 frame . style . transform = "translate(-50%, -50%)" ;
82115 }
83116
84- willRunTest ( suite , test ) {
117+ async willRunTest ( suite , test ) {
85118 document . getElementById ( "info-label" ) . textContent = suite . name ;
86119 document . getElementById ( "info-progress" ) . textContent = `${ this . _finishedTestCount } / ${ this . stepCount } ` ;
120+ if ( this . _steppingPromise )
121+ await this . _awaitNextStep ( suite , test ) ;
87122 }
88123
89124 didRunTest ( ) {
0 commit comments