@@ -17,17 +17,50 @@ class MainBenchmarkClient {
17
17
_hasResults = false ;
18
18
_developerModeContainer = null ;
19
19
_metrics = Object . create ( null ) ;
20
+ _steppingPromise = null ;
21
+ _steppingResolver = null ;
20
22
21
23
constructor ( ) {
22
24
window . addEventListener ( "DOMContentLoaded" , ( ) => this . prepareUI ( ) ) ;
23
25
this . _showSection ( window . location . hash ) ;
24
26
}
25
27
26
28
start ( ) {
27
- if ( this . _startBenchmark ( ) )
29
+ if ( this . _isStepping ( ) )
30
+ this . _clearStepping ( ) ;
31
+ else if ( this . _startBenchmark ( ) )
28
32
this . _showSection ( "#running" ) ;
29
33
}
30
34
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
+
31
64
_startBenchmark ( ) {
32
65
if ( this . _isRunning )
33
66
return false ;
@@ -44,8 +77,8 @@ class MainBenchmarkClient {
44
77
45
78
return false ;
46
79
}
47
-
48
- this . _developerModeContainer ?. remove ( ) ;
80
+ if ( ! this . _isStepping ( ) )
81
+ this . _developerModeContainer ?. remove ( ) ;
49
82
this . _progressCompleted = document . getElementById ( "progress-completed" ) ;
50
83
if ( params . iterationCount < 50 ) {
51
84
const progressNode = document . getElementById ( "progress" ) ;
@@ -81,9 +114,11 @@ class MainBenchmarkClient {
81
114
frame . style . transform = "translate(-50%, -50%)" ;
82
115
}
83
116
84
- willRunTest ( suite , test ) {
117
+ async willRunTest ( suite , test ) {
85
118
document . getElementById ( "info-label" ) . textContent = suite . name ;
86
119
document . getElementById ( "info-progress" ) . textContent = `${ this . _finishedTestCount } / ${ this . stepCount } ` ;
120
+ if ( this . _steppingPromise )
121
+ await this . _awaitNextStep ( suite , test ) ;
87
122
}
88
123
89
124
didRunTest ( ) {
0 commit comments