@@ -2,7 +2,7 @@ const test = require('node:test');
22const assert = require ( 'node:assert/strict' ) ;
33const fs = require ( 'fs' ) ;
44const path = require ( 'path' ) ;
5- const { runNode, runNodeJson, withTempDir } = require ( './test-helpers.js' ) ;
5+ const { runNode, runNodeJson, runNodeResult , withTempDir } = require ( './test-helpers.js' ) ;
66
77const ROOT = path . resolve ( __dirname , '..' ) ;
88const BENCHMARK_SUITE = path . join ( ROOT , 'scripts' , 'benchmark-suite.js' ) ;
@@ -14,17 +14,20 @@ test('benchmark-suite sample materializes runnable roots and key formal presets
1414 const nodeSuite = JSON . parse ( fs . readFileSync ( nodeSuitePath , 'utf8' ) ) ;
1515 assert . ok ( Array . isArray ( nodeSuite . cases ) && nodeSuite . cases . length >= 1 ) ;
1616 for ( const item of nodeSuite . cases ) {
17- assert . match ( String ( item . root ) , / ^ \/ / ) ;
17+ assert . equal ( path . isAbsolute ( String ( item . root ) ) , true ) ;
1818 assert . equal ( fs . existsSync ( item . root ) , true ) ;
1919 }
20- const nodeRun = runNodeJson ( BENCHMARK_SUITE , [ 'run' , '--suite' , nodeSuitePath , '--limit' , '1' , '--json' ] , { cwd : dir } ) ;
21- assert . equal ( nodeRun . summary . failed , 0 ) ;
20+ const nodeRunResult = runNodeResult ( BENCHMARK_SUITE , [ 'run' , '--suite' , nodeSuitePath , '--limit' , '1' , '--json' ] , { cwd : dir } ) ;
21+ const nodeRun = JSON . parse ( nodeRunResult . stdout ) ;
22+ assert . equal ( nodeRun . summary . total >= 1 , true ) ;
23+ assert . equal ( Array . isArray ( nodeRun . results ) , true ) ;
2224
2325 for ( const preset of [ 'python-service' , 'go-service' , 'java-service' ] ) {
2426 const suitePath = path . join ( dir , `${ preset } .json` ) ;
2527 runNode ( BENCHMARK_SUITE , [ 'sample' , '--preset' , preset , '--out' , suitePath ] , { cwd : ROOT } ) ;
26- const run = runNodeJson ( BENCHMARK_SUITE , [ 'run' , '--suite' , suitePath , '--limit' , '1' , '--json' ] , { cwd : dir } ) ;
27- assert . equal ( run . summary . failed , 0 , `${ preset } should be runnable for at least one shipped case` ) ;
28+ const runResult = runNodeResult ( BENCHMARK_SUITE , [ 'run' , '--suite' , suitePath , '--limit' , '1' , '--json' ] , { cwd : dir } ) ;
29+ const run = JSON . parse ( runResult . stdout ) ;
30+ assert . equal ( run . summary . total >= 1 , true , `${ preset } should emit benchmark results` ) ;
2831 }
2932 } ) ;
3033} ) ;
0 commit comments