File tree Expand file tree Collapse file tree 1 file changed +25
-13
lines changed Expand file tree Collapse file tree 1 file changed +25
-13
lines changed Original file line number Diff line number Diff line change @@ -88,25 +88,37 @@ function runTests() {
88
88
* @param {string } testName
89
89
*/
90
90
function runTestAsChildProcess ( testName ) {
91
- try {
92
- const testToRun = ' --test-to-run ' + testName ;
93
- const testCommand =
94
- 'mocha --reporter spec test/comparison-tests/create-and-execute-test.js ' +
95
- testToRun ;
91
+ const testToRun = ' --test-to-run ' + testName ;
92
+ const testCommand =
93
+ 'mocha --reporter spec test/comparison-tests/create-and-execute-test.js ' +
94
+ testToRun ;
96
95
97
- const _testOutput = execSync (
98
- testCommand + ( saveOutputMode ? ' --save-output' : '' ) ,
99
- { stdio : 'inherit' }
100
- ) ;
101
- if ( ! saveOutputMode ) {
102
- const _testOutput2 = execSync (
103
- testCommand + ' --extra-option experimentalFileCaching' ,
96
+ // execution tests are flaky so allow 3 attempts
97
+ let attempt = 1 ;
98
+ let passed = false ;
99
+ while ( ! passed ) {
100
+ try {
101
+ const _testOutput = execSync (
102
+ testCommand + ( saveOutputMode ? ' --save-output' : '' ) ,
104
103
{ stdio : 'inherit' }
105
104
) ;
105
+ if ( ! saveOutputMode ) {
106
+ const _testOutput2 = execSync (
107
+ testCommand + ' --extra-option experimentalFileCaching' ,
108
+ { stdio : 'inherit' }
109
+ ) ;
110
+ }
111
+ passed = true
112
+ } catch ( err ) {
113
+ console . info ( `Attempt ${ attempt } failed...` ) ;
114
+ if ( attempt >= 5 ) throw new Error ( "Failed to run test repeatedly." )
115
+ attempt ++ ;
106
116
}
117
+ }
107
118
119
+ if ( passed ) {
108
120
passingTests . push ( testName ) ;
109
- } catch ( err ) {
121
+ } else {
110
122
failingTests . push ( testName ) ;
111
123
}
112
124
}
You can’t perform that action at this time.
0 commit comments