@@ -27,14 +27,16 @@ exports.localTest262Baseline = "internal/baselines/test262/local";
2727 */
2828function runConsoleTests ( runJs , defaultReporter , runInParallel ) {
2929 let testTimeout = cmdLineOptions . timeout ;
30+ let tests = cmdLineOptions . tests ;
3031 const lintFlag = cmdLineOptions . lint ;
3132 const debug = cmdLineOptions . debug ;
3233 const inspect = cmdLineOptions . inspect ;
33- const tests = cmdLineOptions . tests ;
3434 const runners = cmdLineOptions . runners ;
3535 const light = cmdLineOptions . light ;
3636 const stackTraceLimit = cmdLineOptions . stackTraceLimit ;
3737 const testConfigFile = "test.config" ;
38+ const failed = cmdLineOptions . failed ;
39+ const keepFailed = cmdLineOptions . keepFailed || failed ;
3840 return cleanTestDirs ( )
3941 . then ( ( ) => {
4042 if ( fs . existsSync ( testConfigFile ) ) {
@@ -59,8 +61,8 @@ function runConsoleTests(runJs, defaultReporter, runInParallel) {
5961 testTimeout = 400000 ;
6062 }
6163
62- if ( tests || runners || light || testTimeout || taskConfigsFolder ) {
63- writeTestConfigFile ( tests , runners , light , taskConfigsFolder , workerCount , stackTraceLimit , testTimeout ) ;
64+ if ( tests || runners || light || testTimeout || taskConfigsFolder || keepFailed ) {
65+ writeTestConfigFile ( tests , runners , light , taskConfigsFolder , workerCount , stackTraceLimit , testTimeout , keepFailed ) ;
6466 }
6567
6668 const colors = cmdLineOptions . colors ;
@@ -75,7 +77,8 @@ function runConsoleTests(runJs, defaultReporter, runInParallel) {
7577 // timeout normally isn"t necessary but Travis-CI has been timing out on compiler baselines occasionally
7678 // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
7779 if ( ! runInParallel ) {
78- args . push ( "-R" , reporter ) ;
80+ args . push ( "-R" , "scripts/failed-tests" ) ;
81+ args . push ( "-O" , '"reporter=' + reporter + ( keepFailed ? ",keepFailed=true" : "" ) + '"' ) ;
7982 if ( tests ) {
8083 args . push ( "-g" , `"${ tests } "` ) ;
8184 }
@@ -103,7 +106,12 @@ function runConsoleTests(runJs, defaultReporter, runInParallel) {
103106 args . push ( runJs ) ;
104107 }
105108 setNodeEnvToDevelopment ( ) ;
106- return exec ( host , [ runJs ] ) ;
109+ if ( failed ) {
110+ return exec ( host , [ "scripts/run-failed-tests.js" ] . concat ( args ) ) ;
111+ }
112+ else {
113+ return exec ( host , args ) ;
114+ }
107115 } )
108116 . then ( ( { exitCode } ) => {
109117 if ( exitCode !== 0 ) return finish ( undefined , exitCode ) ;
@@ -148,8 +156,9 @@ exports.cleanTestDirs = cleanTestDirs;
148156 * @param {string | number } [workerCount]
149157 * @param {string } [stackTraceLimit]
150158 * @param {string | number } [timeout]
159+ * @param {boolean } [keepFailed]
151160 */
152- function writeTestConfigFile ( tests , runners , light , taskConfigsFolder , workerCount , stackTraceLimit , timeout ) {
161+ function writeTestConfigFile ( tests , runners , light , taskConfigsFolder , workerCount , stackTraceLimit , timeout , keepFailed ) {
153162 const testConfigContents = JSON . stringify ( {
154163 test : tests ? [ tests ] : undefined ,
155164 runner : runners ? runners . split ( "," ) : undefined ,
@@ -159,6 +168,7 @@ function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCou
159168 taskConfigsFolder,
160169 noColor : ! cmdLineOptions . colors ,
161170 timeout,
171+ keepFailed
162172 } ) ;
163173 log . info ( "Running tests with config: " + testConfigContents ) ;
164174 fs . writeFileSync ( "test.config" , testConfigContents ) ;
0 commit comments