@@ -14,7 +14,7 @@ import type {
1414 TestSuiteResult ,
1515} from '../runtime/setup' ;
1616import type { TestSnapshotResults } from '../runtime/snapshotContext' ;
17- import type { BenchmarkTestArtifact } from './benchmarkUtils ' ;
17+ import type { BenchmarkResult } from '../src/Benchmark ' ;
1818import type {
1919 AsyncCommandResult ,
2020 ConsoleLogMessage ,
@@ -80,7 +80,7 @@ function buildError(
8080
8181async function processRNTesterCommandResult (
8282 result : AsyncCommandResult ,
83- ) : Promise < TestSuiteResult > {
83+ ) : Promise < [ TestSuiteResult , ? BenchmarkResult ] > {
8484 const stdoutChunks = [ ] ;
8585 const stderrChunks = [ ] ;
8686
@@ -92,7 +92,7 @@ async function processRNTesterCommandResult(
9292 stderrChunks . push ( chunk ) ;
9393 } ) ;
9494
95- let testResult ;
95+ let testResult , benchmarkResult ;
9696
9797 const rl = readline . createInterface ( { input : result . childProcess . stdout } ) ;
9898 rl . on ( 'line' , ( rawLine : string ) => {
@@ -116,6 +116,9 @@ async function processRNTesterCommandResult(
116116 case 'test-result' :
117117 testResult = parsed ;
118118 break ;
119+ case 'benchmark-result' :
120+ benchmarkResult = parsed ;
121+ break ;
119122 case 'console-log' :
120123 printConsoleLog ( parsed ) ;
121124 break ;
@@ -152,7 +155,7 @@ async function processRNTesterCommandResult(
152155 ) ;
153156 }
154157
155- return testResult ;
158+ return [ testResult , benchmarkResult ] ;
156159}
157160
158161function generateBytecodeBundle ( {
@@ -223,6 +226,7 @@ module.exports = async function runTest(
223226 ) ;
224227
225228 const testResultsByConfig = [ ] ;
229+ const benchmarkResults = [ ] ;
226230
227231 const skippedTestResults = ( {
228232 ancestorTitles,
@@ -241,7 +245,6 @@ module.exports = async function runTest(
241245 snapshotResults : { } as TestSnapshotResults ,
242246 status : 'pending' as TestCaseResult [ 'status' ] ,
243247 testFilePath : testPath ,
244- testArtifact : { } as mixed ,
245248 title,
246249 } ,
247250 ] ;
@@ -371,9 +374,8 @@ module.exports = async function runTest(
371374 hermesVariant : testConfig . hermesVariant ,
372375 } ) ;
373376
374- const processedResult = await processRNTesterCommandResult (
375- rnTesterCommandResult ,
376- ) ;
377+ const [ processedResult , benchmarkResult ] =
378+ await processRNTesterCommandResult ( rnTesterCommandResult ) ;
377379
378380 if ( containsError ( processedResult ) || EnvironmentOptions . profileJS ) {
379381 await createSourceMap ( {
@@ -439,6 +441,13 @@ module.exports = async function runTest(
439441 } ) ;
440442 }
441443
444+ if ( benchmarkResult != null ) {
445+ benchmarkResults . push ( {
446+ title : testResults [ 0 ] ?. ancestorTitles ?. [ 0 ] ?? maybeCommonAncestor ,
447+ result : benchmarkResult ,
448+ } ) ;
449+ }
450+
442451 testResultsByConfig . push ( testResults ) ;
443452 }
444453
@@ -455,17 +464,7 @@ module.exports = async function runTest(
455464 snapshotResults ,
456465 ) ;
457466
458- printBenchmarkResultsRanking (
459- testResults . map ( testResult => {
460- // $FlowExpectedError[incompatible-cast]
461- const testArtifact = testResult . testArtifact as ?BenchmarkTestArtifact ;
462- const title = testResult . ancestorTitles [ 0 ] ;
463- return {
464- title,
465- testArtifact,
466- } ;
467- } ) ,
468- ) ;
467+ printBenchmarkResultsRanking ( benchmarkResults ) ;
469468
470469 return {
471470 testFilePath : testPath ,
0 commit comments