@@ -274,6 +274,7 @@ async function main() {
274274 trace . hasSchedWait ,
275275 { }
276276 ) ;
277+ if ( pois . length === 0 ) fail ( "No long-poll points of interest found" ) ;
277278 for ( const p of pois ) {
278279 if ( p . type !== "long-poll" ) fail ( `Wrong type: ${ p . type } ` ) ;
279280 if ( p . value <= 1 ) fail ( `long-poll value ${ p . value } <= 1ms` ) ;
@@ -290,6 +291,7 @@ async function main() {
290291 trace . hasSchedWait ,
291292 { }
292293 ) ;
294+ if ( pois . length === 0 ) fail ( "No cpu-sampled points of interest found" ) ;
293295 for ( const p of pois ) {
294296 if ( p . type !== "cpu-sampled" ) fail ( `Wrong type: ${ p . type } ` ) ;
295297 if ( p . value <= 0 ) fail ( `cpu-sampled value ${ p . value } <= 0` ) ;
@@ -306,6 +308,7 @@ async function main() {
306308 trace . hasSchedWait ,
307309 { }
308310 ) ;
311+ if ( pois . length === 0 ) fail ( "No wake-delay points of interest found" ) ;
309312 for ( const p of pois ) {
310313 if ( p . type !== "wake-delay" ) fail ( `Wrong type: ${ p . type } ` ) ;
311314 if ( p . value <= 100 ) fail ( `wake-delay value ${ p . value } <= 100µs` ) ;
@@ -332,8 +335,7 @@ async function main() {
332335
333336 function testFlamegraphTree ( ) {
334337 const cpuSamples = trace . cpuSamples . filter ( ( s ) => s . source !== 1 ) ;
335- if ( cpuSamples . length === 0 )
336- return pass ( "No CPU samples to test flamegraph" ) ;
338+ if ( cpuSamples . length === 0 ) fail ( "No CPU samples found" ) ;
337339
338340 const root = buildFlamegraphTree ( cpuSamples , trace . callframeSymbols ) ;
339341 if ( root . count !== cpuSamples . length )
@@ -343,7 +345,7 @@ async function main() {
343345
344346 function testFlattenFlamegraph ( ) {
345347 const cpuSamples = trace . cpuSamples . filter ( ( s ) => s . source !== 1 ) ;
346- if ( cpuSamples . length === 0 ) return pass ( "No CPU samples to test flatten " ) ;
348+ if ( cpuSamples . length === 0 ) fail ( "No CPU samples found " ) ;
347349
348350 const root = buildFlamegraphTree ( cpuSamples , trace . callframeSymbols ) ;
349351 const { nodes, maxDepth } = flattenFlamegraph ( root , cpuSamples . length ) ;
@@ -357,8 +359,7 @@ async function main() {
357359
358360 function testBuildFgData ( ) {
359361 const cpuSamples = trace . cpuSamples . filter ( ( s ) => s . source !== 1 ) ;
360- if ( cpuSamples . length === 0 )
361- return pass ( "No CPU samples to test buildFgData" ) ;
362+ if ( cpuSamples . length === 0 ) fail ( "No CPU samples found" ) ;
362363
363364 const data = buildFgData ( cpuSamples , trace . callframeSymbols ) ;
364365 if ( ! data ) fail ( "buildFgData returned null for non-empty samples" ) ;
0 commit comments