(reactPath)
| 31 | const skipBuild = argv['skip-build']; |
| 32 | |
| 33 | async function runBenchmarks(reactPath) { |
| 34 | const benchmarkNames = getBenchmarkNames(); |
| 35 | const results = {}; |
| 36 | const server = serveBenchmark(); |
| 37 | await wait(1000); |
| 38 | |
| 39 | for (let i = 0; i < benchmarkNames.length; i++) { |
| 40 | const benchmarkName = benchmarkNames[i]; |
| 41 | |
| 42 | if ( |
| 43 | !benchmarkFilter || |
| 44 | (benchmarkFilter && benchmarkName.indexOf(benchmarkFilter) !== -1) |
| 45 | ) { |
| 46 | console.log( |
| 47 | chalk.gray(`- Building benchmark "${chalk.white(benchmarkName)}"...`) |
| 48 | ); |
| 49 | await buildBenchmark(reactPath, benchmarkName); |
| 50 | console.log( |
| 51 | chalk.gray(`- Running benchmark "${chalk.white(benchmarkName)}"...`) |
| 52 | ); |
| 53 | results[benchmarkName] = await runBenchmark(benchmarkName, headless); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | server.close(); |
| 58 | // http-server.close() is async but they don't provide a callback.. |
| 59 | await wait(500); |
| 60 | return results; |
| 61 | } |
| 62 | |
| 63 | // get the performance benchmark results |
| 64 | // from remote main (default React repo) |
no test coverage detected