11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst http = require('node:http'); // node:* should be filtered out. 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_citry { 51cb0ef41Sopenharmony_ci // This block does not throw. 61cb0ef41Sopenharmony_ci} catch { /* node:coverage ignore next 3 */ 71cb0ef41Sopenharmony_ci // So this block is uncovered. 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci /* node:coverage disable */ 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci /* node:coverage enable */ 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci /* node:coverage ignore next */ 141cb0ef41Sopenharmony_ci} 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_cifunction uncalledTopLevelFunction() { 171cb0ef41Sopenharmony_ci if (true) { 181cb0ef41Sopenharmony_ci return 5; 191cb0ef41Sopenharmony_ci } 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci return 9; 221cb0ef41Sopenharmony_ci} 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ciconst test = require('node:test'); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ciif (false) { 271cb0ef41Sopenharmony_ci console.log('this does not execute'); 281cb0ef41Sopenharmony_ci} else { 291cb0ef41Sopenharmony_ci require('./invalid-tap.js'); 301cb0ef41Sopenharmony_ci} 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_citest('a test', () => { 331cb0ef41Sopenharmony_ci const uncalled = () => {}; 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci function fnWithControlFlow(val) { 361cb0ef41Sopenharmony_ci if (val < 0) { 371cb0ef41Sopenharmony_ci return -1; 381cb0ef41Sopenharmony_ci } else if (val === 0) { 391cb0ef41Sopenharmony_ci return 0; 401cb0ef41Sopenharmony_ci } else if (val < 100) { 411cb0ef41Sopenharmony_ci return 1; 421cb0ef41Sopenharmony_ci } else { 431cb0ef41Sopenharmony_ci return Infinity; 441cb0ef41Sopenharmony_ci } 451cb0ef41Sopenharmony_ci } 461cb0ef41Sopenharmony_ci 471cb0ef41Sopenharmony_ci fnWithControlFlow(-10); 481cb0ef41Sopenharmony_ci fnWithControlFlow(99); 491cb0ef41Sopenharmony_ci}); 501cb0ef41Sopenharmony_ci 511cb0ef41Sopenharmony_citry { 521cb0ef41Sopenharmony_ci require('test-nm'); // node_modules should be filtered out. 531cb0ef41Sopenharmony_ci} catch { 541cb0ef41Sopenharmony_ci 551cb0ef41Sopenharmony_ci} 561cb0ef41Sopenharmony_ci 571cb0ef41Sopenharmony_ciasync function main() { 581cb0ef41Sopenharmony_ci if (false) { console.log('boo'); } else { /* console.log('yay'); */ } 591cb0ef41Sopenharmony_ci 601cb0ef41Sopenharmony_ci if (false) { 611cb0ef41Sopenharmony_ci console.log('not happening'); 621cb0ef41Sopenharmony_ci } 631cb0ef41Sopenharmony_ci 641cb0ef41Sopenharmony_ci if (true) { 651cb0ef41Sopenharmony_ci if (false) { 661cb0ef41Sopenharmony_ci console.log('not printed'); 671cb0ef41Sopenharmony_ci } 681cb0ef41Sopenharmony_ci 691cb0ef41Sopenharmony_ci // Nothing to see here. 701cb0ef41Sopenharmony_ci } else { 711cb0ef41Sopenharmony_ci console.log('also not printed'); 721cb0ef41Sopenharmony_ci } 731cb0ef41Sopenharmony_ci 741cb0ef41Sopenharmony_ci try { 751cb0ef41Sopenharmony_ci const foo = {}; 761cb0ef41Sopenharmony_ci 771cb0ef41Sopenharmony_ci foo.x = 1; 781cb0ef41Sopenharmony_ci require('../v8-coverage/throw.js'); 791cb0ef41Sopenharmony_ci foo.y = 2; 801cb0ef41Sopenharmony_ci return foo; 811cb0ef41Sopenharmony_ci } catch (err) { 821cb0ef41Sopenharmony_ci let bar = []; 831cb0ef41Sopenharmony_ci bar.push(5); 841cb0ef41Sopenharmony_ci } finally { 851cb0ef41Sopenharmony_ci const baz = 1; 861cb0ef41Sopenharmony_ci } 871cb0ef41Sopenharmony_ci} 881cb0ef41Sopenharmony_ci 891cb0ef41Sopenharmony_cimain(); 90