💬 Commit message: Update 2026-02-06 21:43:28, 20 files, 5493 lines

📁 Files changed: 20
📝 Lines changed: 5493

  • base.css
  • block-navigation.js
  • browser.ts.html
  • clover.xml
  • coverage-final.json
  • favicon.png
  • index.html
  • logger.ts.html
  • prettify.css
  • prettify.js
  • server.ts.html
  • sort-arrow-sprite.png
  • sorter.js
  • types.ts.html
  • package-lock.json
  • package.json
  • browser.test.ts
  • logger.test.ts
  • server.test.ts
  • vitest.config.ts
This commit is contained in:
Adam Ladachowski
2026-02-06 21:43:28 +01:00
parent 2736a4b467
commit 880e24877d
20 changed files with 5254 additions and 5 deletions
+224
View File
@@ -0,0 +1,224 @@
body, html {
margin:0; padding: 0;
height: 100%;
}
body {
font-family: Helvetica Neue, Helvetica, Arial;
font-size: 14px;
color:#333;
}
.small { font-size: 12px; }
*, *:after, *:before {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
h1 { font-size: 20px; margin: 0;}
h2 { font-size: 14px; }
pre {
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
margin: 0;
padding: 0;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
a { color:#0074D9; text-decoration:none; }
a:hover { text-decoration:underline; }
.strong { font-weight: bold; }
.space-top1 { padding: 10px 0 0 0; }
.pad2y { padding: 20px 0; }
.pad1y { padding: 10px 0; }
.pad2x { padding: 0 20px; }
.pad2 { padding: 20px; }
.pad1 { padding: 10px; }
.space-left2 { padding-left:55px; }
.space-right2 { padding-right:20px; }
.center { text-align:center; }
.clearfix { display:block; }
.clearfix:after {
content:'';
display:block;
height:0;
clear:both;
visibility:hidden;
}
.fl { float: left; }
@media only screen and (max-width:640px) {
.col3 { width:100%; max-width:100%; }
.hide-mobile { display:none!important; }
}
.quiet {
color: #7f7f7f;
color: rgba(0,0,0,0.5);
}
.quiet a { opacity: 0.7; }
.fraction {
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
font-size: 10px;
color: #555;
background: #E8E8E8;
padding: 4px 5px;
border-radius: 3px;
vertical-align: middle;
}
div.path a:link, div.path a:visited { color: #333; }
table.coverage {
border-collapse: collapse;
margin: 10px 0 0 0;
padding: 0;
}
table.coverage td {
margin: 0;
padding: 0;
vertical-align: top;
}
table.coverage td.line-count {
text-align: right;
padding: 0 5px 0 20px;
}
table.coverage td.line-coverage {
text-align: right;
padding-right: 10px;
min-width:20px;
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 100%;
}
.missing-if-branch {
display: inline-block;
margin-right: 5px;
border-radius: 3px;
position: relative;
padding: 0 4px;
background: #333;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.coverage-summary {
border-collapse: collapse;
width: 100%;
}
.coverage-summary tr { border-bottom: 1px solid #bbb; }
.keyline-all { border: 1px solid #ddd; }
.coverage-summary td, .coverage-summary th { padding: 10px; }
.coverage-summary tbody { border: 1px solid #bbb; }
.coverage-summary td { border-right: 1px solid #bbb; }
.coverage-summary td:last-child { border-right: none; }
.coverage-summary th {
text-align: left;
font-weight: normal;
white-space: nowrap;
}
.coverage-summary th.file { border-right: none !important; }
.coverage-summary th.pct { }
.coverage-summary th.pic,
.coverage-summary th.abs,
.coverage-summary td.pct,
.coverage-summary td.abs { text-align: right; }
.coverage-summary td.file { white-space: nowrap; }
.coverage-summary td.pic { min-width: 120px !important; }
.coverage-summary tfoot td { }
.coverage-summary .sorter {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
}
.coverage-summary .sorted .sorter {
background-position: 0 -20px;
}
.coverage-summary .sorted-desc .sorter {
background-position: 0 -10px;
}
.status-line { height: 10px; }
/* yellow */
.cbranch-no { background: yellow !important; color: #111; }
/* dark red */
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
.low .chart { border:1px solid #C21F39 }
.highlighted,
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
background: #C21F39 !important;
}
/* medium red */
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
/* light red */
.low, .cline-no { background:#FCE1E5 }
/* light green */
.high, .cline-yes { background:rgb(230,245,208) }
/* medium green */
.cstat-yes { background:rgb(161,215,106) }
/* dark green */
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
.high .chart { border:1px solid rgb(77,146,33) }
/* dark yellow (gold) */
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
.medium .chart { border:1px solid #f9cd0b; }
/* light yellow */
.medium { background: #fff4c2; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
span.cline-neutral { background: #eaeaea; }
.coverage-summary td.empty {
opacity: .5;
padding-top: 4px;
padding-bottom: 4px;
line-height: 1;
color: #888;
}
.cover-fill, .cover-empty {
display:inline-block;
height: 12px;
}
.chart {
line-height: 0;
}
.cover-empty {
background: white;
}
.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -48px;
}
.footer, .push {
height: 48px;
}
+87
View File
@@ -0,0 +1,87 @@
/* eslint-disable */
var jumpToCode = (function init() {
// Classes of code we would like to highlight in the file view
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
// Elements to highlight in the file listing view
var fileListingElements = ['td.pct.low'];
// We don't want to select elements that are direct descendants of another match
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
// Selector that finds elements on the page to which we can jump
var selector =
fileListingElements.join(', ') +
', ' +
notSelector +
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
// The NodeList of matching elements
var missingCoverageElements = document.querySelectorAll(selector);
var currentIndex;
function toggleClass(index) {
missingCoverageElements
.item(currentIndex)
.classList.remove('highlighted');
missingCoverageElements.item(index).classList.add('highlighted');
}
function makeCurrent(index) {
toggleClass(index);
currentIndex = index;
missingCoverageElements.item(index).scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center'
});
}
function goToPrevious() {
var nextIndex = 0;
if (typeof currentIndex !== 'number' || currentIndex === 0) {
nextIndex = missingCoverageElements.length - 1;
} else if (missingCoverageElements.length > 1) {
nextIndex = currentIndex - 1;
}
makeCurrent(nextIndex);
}
function goToNext() {
var nextIndex = 0;
if (
typeof currentIndex === 'number' &&
currentIndex < missingCoverageElements.length - 1
) {
nextIndex = currentIndex + 1;
}
makeCurrent(nextIndex);
}
return function jump(event) {
if (
document.getElementById('fileSearch') === document.activeElement &&
document.activeElement != null
) {
// if we're currently focused on the search input, we don't want to navigate
return;
}
switch (event.which) {
case 78: // n
case 74: // j
goToNext();
break;
case 66: // b
case 75: // k
case 80: // p
goToPrevious();
break;
}
};
})();
window.addEventListener('keydown', jumpToCode);
+691
View File
@@ -0,0 +1,691 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for browser.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="index.html">All files</a> browser.ts</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">58.42% </span>
<span class="quiet">Statements</span>
<span class='fraction'>52/89</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">75.67% </span>
<span class="quiet">Branches</span>
<span class='fraction'>28/37</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">80.95% </span>
<span class="quiet">Functions</span>
<span class='fraction'>17/21</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">58.42% </span>
<span class="quiet">Lines</span>
<span class='fraction'>52/89</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a>
<a name='L19'></a><a href='#L19'>19</a>
<a name='L20'></a><a href='#L20'>20</a>
<a name='L21'></a><a href='#L21'>21</a>
<a name='L22'></a><a href='#L22'>22</a>
<a name='L23'></a><a href='#L23'>23</a>
<a name='L24'></a><a href='#L24'>24</a>
<a name='L25'></a><a href='#L25'>25</a>
<a name='L26'></a><a href='#L26'>26</a>
<a name='L27'></a><a href='#L27'>27</a>
<a name='L28'></a><a href='#L28'>28</a>
<a name='L29'></a><a href='#L29'>29</a>
<a name='L30'></a><a href='#L30'>30</a>
<a name='L31'></a><a href='#L31'>31</a>
<a name='L32'></a><a href='#L32'>32</a>
<a name='L33'></a><a href='#L33'>33</a>
<a name='L34'></a><a href='#L34'>34</a>
<a name='L35'></a><a href='#L35'>35</a>
<a name='L36'></a><a href='#L36'>36</a>
<a name='L37'></a><a href='#L37'>37</a>
<a name='L38'></a><a href='#L38'>38</a>
<a name='L39'></a><a href='#L39'>39</a>
<a name='L40'></a><a href='#L40'>40</a>
<a name='L41'></a><a href='#L41'>41</a>
<a name='L42'></a><a href='#L42'>42</a>
<a name='L43'></a><a href='#L43'>43</a>
<a name='L44'></a><a href='#L44'>44</a>
<a name='L45'></a><a href='#L45'>45</a>
<a name='L46'></a><a href='#L46'>46</a>
<a name='L47'></a><a href='#L47'>47</a>
<a name='L48'></a><a href='#L48'>48</a>
<a name='L49'></a><a href='#L49'>49</a>
<a name='L50'></a><a href='#L50'>50</a>
<a name='L51'></a><a href='#L51'>51</a>
<a name='L52'></a><a href='#L52'>52</a>
<a name='L53'></a><a href='#L53'>53</a>
<a name='L54'></a><a href='#L54'>54</a>
<a name='L55'></a><a href='#L55'>55</a>
<a name='L56'></a><a href='#L56'>56</a>
<a name='L57'></a><a href='#L57'>57</a>
<a name='L58'></a><a href='#L58'>58</a>
<a name='L59'></a><a href='#L59'>59</a>
<a name='L60'></a><a href='#L60'>60</a>
<a name='L61'></a><a href='#L61'>61</a>
<a name='L62'></a><a href='#L62'>62</a>
<a name='L63'></a><a href='#L63'>63</a>
<a name='L64'></a><a href='#L64'>64</a>
<a name='L65'></a><a href='#L65'>65</a>
<a name='L66'></a><a href='#L66'>66</a>
<a name='L67'></a><a href='#L67'>67</a>
<a name='L68'></a><a href='#L68'>68</a>
<a name='L69'></a><a href='#L69'>69</a>
<a name='L70'></a><a href='#L70'>70</a>
<a name='L71'></a><a href='#L71'>71</a>
<a name='L72'></a><a href='#L72'>72</a>
<a name='L73'></a><a href='#L73'>73</a>
<a name='L74'></a><a href='#L74'>74</a>
<a name='L75'></a><a href='#L75'>75</a>
<a name='L76'></a><a href='#L76'>76</a>
<a name='L77'></a><a href='#L77'>77</a>
<a name='L78'></a><a href='#L78'>78</a>
<a name='L79'></a><a href='#L79'>79</a>
<a name='L80'></a><a href='#L80'>80</a>
<a name='L81'></a><a href='#L81'>81</a>
<a name='L82'></a><a href='#L82'>82</a>
<a name='L83'></a><a href='#L83'>83</a>
<a name='L84'></a><a href='#L84'>84</a>
<a name='L85'></a><a href='#L85'>85</a>
<a name='L86'></a><a href='#L86'>86</a>
<a name='L87'></a><a href='#L87'>87</a>
<a name='L88'></a><a href='#L88'>88</a>
<a name='L89'></a><a href='#L89'>89</a>
<a name='L90'></a><a href='#L90'>90</a>
<a name='L91'></a><a href='#L91'>91</a>
<a name='L92'></a><a href='#L92'>92</a>
<a name='L93'></a><a href='#L93'>93</a>
<a name='L94'></a><a href='#L94'>94</a>
<a name='L95'></a><a href='#L95'>95</a>
<a name='L96'></a><a href='#L96'>96</a>
<a name='L97'></a><a href='#L97'>97</a>
<a name='L98'></a><a href='#L98'>98</a>
<a name='L99'></a><a href='#L99'>99</a>
<a name='L100'></a><a href='#L100'>100</a>
<a name='L101'></a><a href='#L101'>101</a>
<a name='L102'></a><a href='#L102'>102</a>
<a name='L103'></a><a href='#L103'>103</a>
<a name='L104'></a><a href='#L104'>104</a>
<a name='L105'></a><a href='#L105'>105</a>
<a name='L106'></a><a href='#L106'>106</a>
<a name='L107'></a><a href='#L107'>107</a>
<a name='L108'></a><a href='#L108'>108</a>
<a name='L109'></a><a href='#L109'>109</a>
<a name='L110'></a><a href='#L110'>110</a>
<a name='L111'></a><a href='#L111'>111</a>
<a name='L112'></a><a href='#L112'>112</a>
<a name='L113'></a><a href='#L113'>113</a>
<a name='L114'></a><a href='#L114'>114</a>
<a name='L115'></a><a href='#L115'>115</a>
<a name='L116'></a><a href='#L116'>116</a>
<a name='L117'></a><a href='#L117'>117</a>
<a name='L118'></a><a href='#L118'>118</a>
<a name='L119'></a><a href='#L119'>119</a>
<a name='L120'></a><a href='#L120'>120</a>
<a name='L121'></a><a href='#L121'>121</a>
<a name='L122'></a><a href='#L122'>122</a>
<a name='L123'></a><a href='#L123'>123</a>
<a name='L124'></a><a href='#L124'>124</a>
<a name='L125'></a><a href='#L125'>125</a>
<a name='L126'></a><a href='#L126'>126</a>
<a name='L127'></a><a href='#L127'>127</a>
<a name='L128'></a><a href='#L128'>128</a>
<a name='L129'></a><a href='#L129'>129</a>
<a name='L130'></a><a href='#L130'>130</a>
<a name='L131'></a><a href='#L131'>131</a>
<a name='L132'></a><a href='#L132'>132</a>
<a name='L133'></a><a href='#L133'>133</a>
<a name='L134'></a><a href='#L134'>134</a>
<a name='L135'></a><a href='#L135'>135</a>
<a name='L136'></a><a href='#L136'>136</a>
<a name='L137'></a><a href='#L137'>137</a>
<a name='L138'></a><a href='#L138'>138</a>
<a name='L139'></a><a href='#L139'>139</a>
<a name='L140'></a><a href='#L140'>140</a>
<a name='L141'></a><a href='#L141'>141</a>
<a name='L142'></a><a href='#L142'>142</a>
<a name='L143'></a><a href='#L143'>143</a>
<a name='L144'></a><a href='#L144'>144</a>
<a name='L145'></a><a href='#L145'>145</a>
<a name='L146'></a><a href='#L146'>146</a>
<a name='L147'></a><a href='#L147'>147</a>
<a name='L148'></a><a href='#L148'>148</a>
<a name='L149'></a><a href='#L149'>149</a>
<a name='L150'></a><a href='#L150'>150</a>
<a name='L151'></a><a href='#L151'>151</a>
<a name='L152'></a><a href='#L152'>152</a>
<a name='L153'></a><a href='#L153'>153</a>
<a name='L154'></a><a href='#L154'>154</a>
<a name='L155'></a><a href='#L155'>155</a>
<a name='L156'></a><a href='#L156'>156</a>
<a name='L157'></a><a href='#L157'>157</a>
<a name='L158'></a><a href='#L158'>158</a>
<a name='L159'></a><a href='#L159'>159</a>
<a name='L160'></a><a href='#L160'>160</a>
<a name='L161'></a><a href='#L161'>161</a>
<a name='L162'></a><a href='#L162'>162</a>
<a name='L163'></a><a href='#L163'>163</a>
<a name='L164'></a><a href='#L164'>164</a>
<a name='L165'></a><a href='#L165'>165</a>
<a name='L166'></a><a href='#L166'>166</a>
<a name='L167'></a><a href='#L167'>167</a>
<a name='L168'></a><a href='#L168'>168</a>
<a name='L169'></a><a href='#L169'>169</a>
<a name='L170'></a><a href='#L170'>170</a>
<a name='L171'></a><a href='#L171'>171</a>
<a name='L172'></a><a href='#L172'>172</a>
<a name='L173'></a><a href='#L173'>173</a>
<a name='L174'></a><a href='#L174'>174</a>
<a name='L175'></a><a href='#L175'>175</a>
<a name='L176'></a><a href='#L176'>176</a>
<a name='L177'></a><a href='#L177'>177</a>
<a name='L178'></a><a href='#L178'>178</a>
<a name='L179'></a><a href='#L179'>179</a>
<a name='L180'></a><a href='#L180'>180</a>
<a name='L181'></a><a href='#L181'>181</a>
<a name='L182'></a><a href='#L182'>182</a>
<a name='L183'></a><a href='#L183'>183</a>
<a name='L184'></a><a href='#L184'>184</a>
<a name='L185'></a><a href='#L185'>185</a>
<a name='L186'></a><a href='#L186'>186</a>
<a name='L187'></a><a href='#L187'>187</a>
<a name='L188'></a><a href='#L188'>188</a>
<a name='L189'></a><a href='#L189'>189</a>
<a name='L190'></a><a href='#L190'>190</a>
<a name='L191'></a><a href='#L191'>191</a>
<a name='L192'></a><a href='#L192'>192</a>
<a name='L193'></a><a href='#L193'>193</a>
<a name='L194'></a><a href='#L194'>194</a>
<a name='L195'></a><a href='#L195'>195</a>
<a name='L196'></a><a href='#L196'>196</a>
<a name='L197'></a><a href='#L197'>197</a>
<a name='L198'></a><a href='#L198'>198</a>
<a name='L199'></a><a href='#L199'>199</a>
<a name='L200'></a><a href='#L200'>200</a>
<a name='L201'></a><a href='#L201'>201</a>
<a name='L202'></a><a href='#L202'>202</a>
<a name='L203'></a><a href='#L203'>203</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import { resolve } from 'node:path';
import { type Browser, type BrowserContext, type Page, webkit } from 'playwright';
import type { BrowserCommand, BrowserOptions, CommandResponse, ElementInfo } from './types.js';
&nbsp;
export class ClaudeBrowser {
private browser: Browser | null = null;
private context: BrowserContext | null = null;
private page: Page | null = null;
private options: Required&lt;BrowserOptions&gt;;
&nbsp;
constructor(options: BrowserOptions = {}) {
this.options = {
headless: options.headless ?? true,
width: options.width ?? 1280,
height: options.height ?? 800,
};
}
&nbsp;
async <span class="fstat-no" title="function not covered" >launch(): Promise&lt;void&gt; {</span>
<span class="cstat-no" title="statement not covered" > this.browser = await webkit.launch({ headless: this.options.headless });</span>
<span class="cstat-no" title="statement not covered" > this.context = await this.browser.newContext({</span>
viewport: {
width: this.options.width,
height: this.options.height,
},
});
<span class="cstat-no" title="statement not covered" > this.page = await this.context.newPage();</span>
}
&nbsp;
async close(): Promise&lt;void&gt; {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.browser) {
<span class="cstat-no" title="statement not covered" > await this.browser.close();</span>
<span class="cstat-no" title="statement not covered" > this.browser = null;</span>
<span class="cstat-no" title="statement not covered" > this.context = null;</span>
<span class="cstat-no" title="statement not covered" > this.page = null;</span>
}
}
&nbsp;
private ensurePage(): Page {
<span class="missing-if-branch" title="else path not taken" >E</span>if (!this.page) {
throw new Error('Browser not launched. Call launch() first.');
}
<span class="cstat-no" title="statement not covered" > return this.page;</span>
}
&nbsp;
async goto(url: string): Promise&lt;{ url: string; title: string }&gt; {
const page = this.ensurePage();
await page.goto(url, { waitUntil: 'networkidle' });
<span class="cstat-no" title="statement not covered" > return { url: page.url(), title: await page.title() };</span>
}
&nbsp;
async click(selector: string): Promise&lt;{ url: string }&gt; {
const page = this.ensurePage();
await page.click(selector);
<span class="cstat-no" title="statement not covered" > await page.waitForLoadState('networkidle').catch(<span class="fstat-no" title="function not covered" >() =&gt; {</span>});</span>
<span class="cstat-no" title="statement not covered" > return { url: page.url() };</span>
}
&nbsp;
async type(selector: string, text: string): Promise&lt;void&gt; {
const page = this.ensurePage();
await page.fill(selector, text);
}
&nbsp;
async query(selector: string): Promise&lt;ElementInfo[]&gt; {
const page = this.ensurePage();
return page.$$eval(selector, <span class="fstat-no" title="function not covered" >(n</span>odes) =&gt;
<span class="cstat-no" title="statement not covered" > nodes.map(<span class="fstat-no" title="function not covered" >(e</span>l) =&gt; {</span>
const attrs: Record&lt;string, string&gt; = <span class="cstat-no" title="statement not covered" >{};</span>
<span class="cstat-no" title="statement not covered" > for (const attr of el.attributes) {</span>
<span class="cstat-no" title="statement not covered" > attrs[attr.name] = attr.value;</span>
}
<span class="cstat-no" title="statement not covered" > return {</span>
tag: el.tagName.toLowerCase(),
text: el.textContent?.trim().slice(0, 200) || '',
attributes: attrs,
};
})
);
}
&nbsp;
async screenshot(path?: string, fullPage = false): Promise&lt;{ path: string; buffer?: Buffer }&gt; {
const page = this.ensurePage();
const resolvedPath = resolve(path || <span class="branch-1 cbranch-no" title="branch not covered" >'screenshot.png')</span>;
const buffer = await page.screenshot({ path: resolvedPath, fullPage });
<span class="cstat-no" title="statement not covered" > return { path: resolvedPath, buffer };</span>
}
&nbsp;
async getUrl(): Promise&lt;{ url: string; title: string }&gt; {
const page = this.ensurePage();
return { url: page.url(), title: await page.title() };
}
&nbsp;
async getHtml(full = false): Promise&lt;string&gt; {
const page = this.ensurePage();
const html = await page.content();
<span class="cstat-no" title="statement not covered" > return full ? html : html.slice(0, 10000);</span>
}
&nbsp;
async back(): Promise&lt;{ url: string }&gt; {
const page = this.ensurePage();
await page.goBack();
<span class="cstat-no" title="statement not covered" > return { url: page.url() };</span>
}
&nbsp;
async forward(): Promise&lt;{ url: string }&gt; {
const page = this.ensurePage();
await page.goForward();
<span class="cstat-no" title="statement not covered" > return { url: page.url() };</span>
}
&nbsp;
async reload(): Promise&lt;{ url: string }&gt; {
const page = this.ensurePage();
await page.reload();
<span class="cstat-no" title="statement not covered" > return { url: page.url() };</span>
}
&nbsp;
async wait(ms = 1000): Promise&lt;void&gt; {
const page = this.ensurePage();
await page.waitForTimeout(ms);
}
&nbsp;
async newPage(): Promise&lt;void&gt; {
<span class="missing-if-branch" title="else path not taken" >E</span>if (!this.context) {
throw new Error('Browser not launched. Call launch() first.');
}
<span class="cstat-no" title="statement not covered" > this.page = await this.context.newPage();</span>
}
&nbsp;
async eval(script: string): Promise&lt;unknown&gt; {
const page = this.ensurePage();
return page.evaluate(script);
}
&nbsp;
async executeCommand(cmd: BrowserCommand): Promise&lt;CommandResponse&gt; {
try {
switch (cmd.cmd) {
case 'goto': {
const result = await this.goto(cmd.url);
<span class="cstat-no" title="statement not covered" > return { ok: true, ...result };</span>
}
case 'click': {
const result = await this.click(cmd.selector);
<span class="cstat-no" title="statement not covered" > return { ok: true, ...result };</span>
}
case 'type': {
await this.type(cmd.selector, cmd.text);
<span class="cstat-no" title="statement not covered" > return { ok: true };</span>
}
case 'query': {
const elements = await this.query(cmd.selector);
<span class="cstat-no" title="statement not covered" > return { ok: true, count: elements.length, elements };</span>
}
case 'screenshot': {
const result = await this.screenshot(cmd.path, cmd.fullPage);
<span class="cstat-no" title="statement not covered" > return { ok: true, path: result.path };</span>
}
case 'url': {
const result = await this.getUrl();
<span class="cstat-no" title="statement not covered" > return { ok: true, ...result };</span>
}
case 'html': {
const html = await this.getHtml(cmd.full);
<span class="cstat-no" title="statement not covered" > return { ok: true, html };</span>
}
case 'back': {
const result = await this.back();
<span class="cstat-no" title="statement not covered" > return { ok: true, ...result };</span>
}
case 'forward': {
const result = await this.forward();
<span class="cstat-no" title="statement not covered" > return { ok: true, ...result };</span>
}
case 'reload': {
const result = await this.reload();
<span class="cstat-no" title="statement not covered" > return { ok: true, ...result };</span>
}
case 'wait': {
await this.wait(cmd.ms);
<span class="cstat-no" title="statement not covered" > return { ok: true };</span>
}
case 'newpage': {
await this.newPage();
<span class="cstat-no" title="statement not covered" > return { ok: true };</span>
}
case 'close': {
await this.close();
return { ok: true };
}
case 'eval': {
const result = await this.eval(cmd.script);
<span class="cstat-no" title="statement not covered" > return { ok: true, result };</span>
}
<span class="branch-14 cbranch-no" title="branch not covered" > default: {</span>
const _exhaustive: never = <span class="cstat-no" title="statement not covered" >cmd;</span>
<span class="cstat-no" title="statement not covered" > return { ok: false, error: `Unknown command: ${(_exhaustive as { cmd: string }).cmd}` };</span>
}
}
} catch (err) {
return { ok: false, error: (err as Error).message };
}
}
}
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-02-06T20:43:25.074Z
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>
+195
View File
@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1770410605079" clover="3.2.0">
<project timestamp="1770410605079" name="All files">
<metrics statements="177" coveredstatements="108" conditionals="89" coveredconditionals="63" methods="50" coveredmethods="38" elements="316" coveredelements="209" complexity="0" loc="177" ncloc="177" packages="1" files="4" classes="4"/>
<file name="browser.ts" path="/Users/chi/Projects/claude-browse/src/browser.ts">
<metrics statements="89" coveredstatements="52" conditionals="37" coveredconditionals="28" methods="21" coveredmethods="17"/>
<line num="6" count="6" type="stmt"/>
<line num="7" count="6" type="stmt"/>
<line num="8" count="6" type="stmt"/>
<line num="12" count="6" type="stmt"/>
<line num="20" count="0" type="stmt"/>
<line num="21" count="0" type="stmt"/>
<line num="27" count="0" type="stmt"/>
<line num="31" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="32" count="0" type="stmt"/>
<line num="33" count="0" type="stmt"/>
<line num="34" count="0" type="stmt"/>
<line num="35" count="0" type="stmt"/>
<line num="40" count="12" type="cond" truecount="1" falsecount="1"/>
<line num="41" count="12" type="stmt"/>
<line num="43" count="0" type="stmt"/>
<line num="47" count="1" type="stmt"/>
<line num="48" count="1" type="stmt"/>
<line num="49" count="0" type="stmt"/>
<line num="53" count="1" type="stmt"/>
<line num="54" count="1" type="stmt"/>
<line num="55" count="0" type="stmt"/>
<line num="56" count="0" type="stmt"/>
<line num="60" count="1" type="stmt"/>
<line num="61" count="1" type="stmt"/>
<line num="65" count="1" type="stmt"/>
<line num="66" count="1" type="stmt"/>
<line num="67" count="0" type="stmt"/>
<line num="68" count="0" type="stmt"/>
<line num="69" count="0" type="stmt"/>
<line num="70" count="0" type="stmt"/>
<line num="72" count="0" type="stmt"/>
<line num="82" count="1" type="stmt"/>
<line num="83" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="84" count="1" type="stmt"/>
<line num="85" count="0" type="stmt"/>
<line num="89" count="1" type="stmt"/>
<line num="90" count="1" type="stmt"/>
<line num="94" count="1" type="stmt"/>
<line num="95" count="1" type="stmt"/>
<line num="96" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="100" count="1" type="stmt"/>
<line num="101" count="1" type="stmt"/>
<line num="102" count="0" type="stmt"/>
<line num="106" count="1" type="stmt"/>
<line num="107" count="1" type="stmt"/>
<line num="108" count="0" type="stmt"/>
<line num="112" count="1" type="stmt"/>
<line num="113" count="1" type="stmt"/>
<line num="114" count="0" type="stmt"/>
<line num="118" count="1" type="stmt"/>
<line num="119" count="1" type="stmt"/>
<line num="123" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="124" count="1" type="stmt"/>
<line num="126" count="0" type="stmt"/>
<line num="130" count="1" type="stmt"/>
<line num="131" count="1" type="stmt"/>
<line num="135" count="14" type="stmt"/>
<line num="136" count="14" type="cond" truecount="14" falsecount="1"/>
<line num="138" count="1" type="stmt"/>
<line num="139" count="0" type="stmt"/>
<line num="142" count="1" type="stmt"/>
<line num="143" count="0" type="stmt"/>
<line num="146" count="1" type="stmt"/>
<line num="147" count="0" type="stmt"/>
<line num="150" count="1" type="stmt"/>
<line num="151" count="0" type="stmt"/>
<line num="154" count="1" type="stmt"/>
<line num="155" count="0" type="stmt"/>
<line num="158" count="1" type="stmt"/>
<line num="159" count="0" type="stmt"/>
<line num="162" count="1" type="stmt"/>
<line num="163" count="0" type="stmt"/>
<line num="166" count="1" type="stmt"/>
<line num="167" count="0" type="stmt"/>
<line num="170" count="1" type="stmt"/>
<line num="171" count="0" type="stmt"/>
<line num="174" count="1" type="stmt"/>
<line num="175" count="0" type="stmt"/>
<line num="178" count="1" type="stmt"/>
<line num="179" count="0" type="stmt"/>
<line num="182" count="1" type="stmt"/>
<line num="183" count="0" type="stmt"/>
<line num="186" count="1" type="stmt"/>
<line num="187" count="1" type="stmt"/>
<line num="190" count="1" type="stmt"/>
<line num="191" count="0" type="stmt"/>
<line num="194" count="0" type="stmt"/>
<line num="195" count="0" type="stmt"/>
<line num="199" count="13" type="stmt"/>
</file>
<file name="logger.ts" path="/Users/chi/Projects/claude-browse/src/logger.ts">
<metrics statements="37" coveredstatements="34" conditionals="42" coveredconditionals="28" methods="16" coveredmethods="13"/>
<line num="5" count="2" type="stmt"/>
<line num="23" count="2" type="stmt"/>
<line num="41" count="23" type="stmt"/>
<line num="45" count="3" type="cond" truecount="2" falsecount="0"/>
<line num="60" count="18" type="cond" truecount="8" falsecount="1"/>
<line num="62" count="4" type="stmt"/>
<line num="65" count="5" type="stmt"/>
<line num="67" count="2" type="stmt"/>
<line num="69" count="2" type="cond" truecount="2" falsecount="0"/>
<line num="71" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="73" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="75" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="77" count="3" type="stmt"/>
<line num="82" count="11" type="cond" truecount="1" falsecount="1"/>
<line num="83" count="11" type="cond" truecount="1" falsecount="1"/>
<line num="84" count="11" type="stmt"/>
<line num="85" count="11" type="cond" truecount="2" falsecount="0"/>
<line num="86" count="11" type="stmt"/>
<line num="100" count="2" type="stmt"/>
<line num="101" count="3" type="stmt"/>
<line num="102" count="2" type="cond" truecount="1" falsecount="1"/>
<line num="103" count="2" type="cond" truecount="1" falsecount="1"/>
<line num="104" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="105" count="2" type="stmt"/>
<line num="106" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="107" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="111" count="12" type="cond" truecount="2" falsecount="0"/>
<line num="112" count="1" type="stmt"/>
<line num="114" count="11" type="stmt"/>
<line num="115" count="11" type="cond" truecount="2" falsecount="0"/>
<line num="116" count="12" type="cond" truecount="2" falsecount="0"/>
<line num="117" count="12" type="stmt"/>
<line num="123" count="6" type="stmt"/>
<line num="125" count="9" type="stmt"/>
<line num="128" count="9" type="stmt"/>
<line num="134" count="2" type="stmt"/>
<line num="137" count="2" type="stmt"/>
</file>
<file name="server.ts" path="/Users/chi/Projects/claude-browse/src/server.ts">
<metrics statements="51" coveredstatements="22" conditionals="10" coveredconditionals="7" methods="13" coveredmethods="8"/>
<line num="13" count="0" type="stmt"/>
<line num="14" count="0" type="stmt"/>
<line num="15" count="0" type="stmt"/>
<line num="16" count="0" type="stmt"/>
<line num="17" count="0" type="stmt"/>
<line num="18" count="0" type="stmt"/>
<line num="19" count="0" type="stmt"/>
<line num="22" count="0" type="stmt"/>
<line num="25" count="0" type="stmt"/>
<line num="26" count="0" type="stmt"/>
<line num="27" count="0" type="stmt"/>
<line num="30" count="0" type="stmt"/>
<line num="35" count="3" type="stmt"/>
<line num="36" count="3" type="stmt"/>
<line num="40" count="3" type="stmt"/>
<line num="41" count="3" type="cond" truecount="2" falsecount="0"/>
<line num="42" count="3" type="stmt"/>
<line num="43" count="3" type="stmt"/>
<line num="47" count="3" type="stmt"/>
<line num="48" count="3" type="stmt"/>
<line num="52" count="7" type="stmt"/>
<line num="56" count="7" type="stmt"/>
<line num="57" count="7" type="cond" truecount="2" falsecount="0"/>
<line num="58" count="7" type="stmt"/>
<line num="60" count="7" type="cond" truecount="1" falsecount="1"/>
<line num="61" count="0" type="stmt"/>
<line num="62" count="0" type="stmt"/>
<line num="63" count="0" type="stmt"/>
<line num="64" count="0" type="stmt"/>
<line num="67" count="7" type="stmt"/>
<line num="68" count="7" type="stmt"/>
<line num="69" count="7" type="stmt"/>
<line num="71" count="0" type="stmt"/>
<line num="72" count="0" type="stmt"/>
<line num="73" count="0" type="stmt"/>
<line num="78" count="0" type="stmt"/>
<line num="80" count="0" type="stmt"/>
<line num="81" count="0" type="stmt"/>
<line num="82" count="0" type="stmt"/>
<line num="83" count="0" type="stmt"/>
<line num="89" count="1" type="stmt"/>
<line num="90" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="91" count="0" type="stmt"/>
<line num="92" count="0" type="stmt"/>
<line num="94" count="1" type="stmt"/>
<line num="95" count="1" type="stmt"/>
<line num="99" count="2" type="stmt"/>
<line num="103" count="7" type="stmt"/>
<line num="108" count="0" type="stmt"/>
<line num="109" count="0" type="stmt"/>
<line num="110" count="0" type="stmt"/>
</file>
<file name="types.ts" path="/Users/chi/Projects/claude-browse/src/types.ts">
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
</file>
</project>
</coverage>
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

+161
View File
@@ -0,0 +1,161 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for All files</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>All files</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">60.89% </span>
<span class="quiet">Statements</span>
<span class='fraction'>109/179</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">70.78% </span>
<span class="quiet">Branches</span>
<span class='fraction'>63/89</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">76% </span>
<span class="quiet">Functions</span>
<span class='fraction'>38/50</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">61.01% </span>
<span class="quiet">Lines</span>
<span class='fraction'>108/177</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line medium'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file medium" data-value="browser.ts"><a href="browser.ts.html">browser.ts</a></td>
<td data-value="58.42" class="pic medium">
<div class="chart"><div class="cover-fill" style="width: 58%"></div><div class="cover-empty" style="width: 42%"></div></div>
</td>
<td data-value="58.42" class="pct medium">58.42%</td>
<td data-value="89" class="abs medium">52/89</td>
<td data-value="75.67" class="pct medium">75.67%</td>
<td data-value="37" class="abs medium">28/37</td>
<td data-value="80.95" class="pct high">80.95%</td>
<td data-value="21" class="abs high">17/21</td>
<td data-value="58.42" class="pct medium">58.42%</td>
<td data-value="89" class="abs medium">52/89</td>
</tr>
<tr>
<td class="file high" data-value="logger.ts"><a href="logger.ts.html">logger.ts</a></td>
<td data-value="89.47" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 89%"></div><div class="cover-empty" style="width: 11%"></div></div>
</td>
<td data-value="89.47" class="pct high">89.47%</td>
<td data-value="38" class="abs high">34/38</td>
<td data-value="66.66" class="pct medium">66.66%</td>
<td data-value="42" class="abs medium">28/42</td>
<td data-value="81.25" class="pct high">81.25%</td>
<td data-value="16" class="abs high">13/16</td>
<td data-value="91.89" class="pct high">91.89%</td>
<td data-value="37" class="abs high">34/37</td>
</tr>
<tr>
<td class="file low" data-value="server.ts"><a href="server.ts.html">server.ts</a></td>
<td data-value="44.23" class="pic low">
<div class="chart"><div class="cover-fill" style="width: 44%"></div><div class="cover-empty" style="width: 56%"></div></div>
</td>
<td data-value="44.23" class="pct low">44.23%</td>
<td data-value="52" class="abs low">23/52</td>
<td data-value="70" class="pct medium">70%</td>
<td data-value="10" class="abs medium">7/10</td>
<td data-value="61.53" class="pct medium">61.53%</td>
<td data-value="13" class="abs medium">8/13</td>
<td data-value="43.13" class="pct low">43.13%</td>
<td data-value="51" class="abs low">22/51</td>
</tr>
<tr>
<td class="file empty" data-value="types.ts"><a href="types.ts.html">types.ts</a></td>
<td data-value="0" class="pic empty">
<div class="chart"><div class="cover-fill" style="width: 0%"></div><div class="cover-empty" style="width: 100%"></div></div>
</td>
<td data-value="0" class="pct empty">0%</td>
<td data-value="0" class="abs empty">0/0</td>
<td data-value="0" class="pct empty">0%</td>
<td data-value="0" class="abs empty">0/0</td>
<td data-value="0" class="pct empty">0%</td>
<td data-value="0" class="abs empty">0/0</td>
<td data-value="0" class="pct empty">0%</td>
<td data-value="0" class="abs empty">0/0</td>
</tr>
</tbody>
</table>
</div>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-02-06T20:43:25.074Z
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>
+496
View File
@@ -0,0 +1,496 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for logger.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="index.html">All files</a> logger.ts</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">89.47% </span>
<span class="quiet">Statements</span>
<span class='fraction'>34/38</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">66.66% </span>
<span class="quiet">Branches</span>
<span class='fraction'>28/42</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">81.25% </span>
<span class="quiet">Functions</span>
<span class='fraction'>13/16</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">91.89% </span>
<span class="quiet">Lines</span>
<span class='fraction'>34/37</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a>
<a name='L19'></a><a href='#L19'>19</a>
<a name='L20'></a><a href='#L20'>20</a>
<a name='L21'></a><a href='#L21'>21</a>
<a name='L22'></a><a href='#L22'>22</a>
<a name='L23'></a><a href='#L23'>23</a>
<a name='L24'></a><a href='#L24'>24</a>
<a name='L25'></a><a href='#L25'>25</a>
<a name='L26'></a><a href='#L26'>26</a>
<a name='L27'></a><a href='#L27'>27</a>
<a name='L28'></a><a href='#L28'>28</a>
<a name='L29'></a><a href='#L29'>29</a>
<a name='L30'></a><a href='#L30'>30</a>
<a name='L31'></a><a href='#L31'>31</a>
<a name='L32'></a><a href='#L32'>32</a>
<a name='L33'></a><a href='#L33'>33</a>
<a name='L34'></a><a href='#L34'>34</a>
<a name='L35'></a><a href='#L35'>35</a>
<a name='L36'></a><a href='#L36'>36</a>
<a name='L37'></a><a href='#L37'>37</a>
<a name='L38'></a><a href='#L38'>38</a>
<a name='L39'></a><a href='#L39'>39</a>
<a name='L40'></a><a href='#L40'>40</a>
<a name='L41'></a><a href='#L41'>41</a>
<a name='L42'></a><a href='#L42'>42</a>
<a name='L43'></a><a href='#L43'>43</a>
<a name='L44'></a><a href='#L44'>44</a>
<a name='L45'></a><a href='#L45'>45</a>
<a name='L46'></a><a href='#L46'>46</a>
<a name='L47'></a><a href='#L47'>47</a>
<a name='L48'></a><a href='#L48'>48</a>
<a name='L49'></a><a href='#L49'>49</a>
<a name='L50'></a><a href='#L50'>50</a>
<a name='L51'></a><a href='#L51'>51</a>
<a name='L52'></a><a href='#L52'>52</a>
<a name='L53'></a><a href='#L53'>53</a>
<a name='L54'></a><a href='#L54'>54</a>
<a name='L55'></a><a href='#L55'>55</a>
<a name='L56'></a><a href='#L56'>56</a>
<a name='L57'></a><a href='#L57'>57</a>
<a name='L58'></a><a href='#L58'>58</a>
<a name='L59'></a><a href='#L59'>59</a>
<a name='L60'></a><a href='#L60'>60</a>
<a name='L61'></a><a href='#L61'>61</a>
<a name='L62'></a><a href='#L62'>62</a>
<a name='L63'></a><a href='#L63'>63</a>
<a name='L64'></a><a href='#L64'>64</a>
<a name='L65'></a><a href='#L65'>65</a>
<a name='L66'></a><a href='#L66'>66</a>
<a name='L67'></a><a href='#L67'>67</a>
<a name='L68'></a><a href='#L68'>68</a>
<a name='L69'></a><a href='#L69'>69</a>
<a name='L70'></a><a href='#L70'>70</a>
<a name='L71'></a><a href='#L71'>71</a>
<a name='L72'></a><a href='#L72'>72</a>
<a name='L73'></a><a href='#L73'>73</a>
<a name='L74'></a><a href='#L74'>74</a>
<a name='L75'></a><a href='#L75'>75</a>
<a name='L76'></a><a href='#L76'>76</a>
<a name='L77'></a><a href='#L77'>77</a>
<a name='L78'></a><a href='#L78'>78</a>
<a name='L79'></a><a href='#L79'>79</a>
<a name='L80'></a><a href='#L80'>80</a>
<a name='L81'></a><a href='#L81'>81</a>
<a name='L82'></a><a href='#L82'>82</a>
<a name='L83'></a><a href='#L83'>83</a>
<a name='L84'></a><a href='#L84'>84</a>
<a name='L85'></a><a href='#L85'>85</a>
<a name='L86'></a><a href='#L86'>86</a>
<a name='L87'></a><a href='#L87'>87</a>
<a name='L88'></a><a href='#L88'>88</a>
<a name='L89'></a><a href='#L89'>89</a>
<a name='L90'></a><a href='#L90'>90</a>
<a name='L91'></a><a href='#L91'>91</a>
<a name='L92'></a><a href='#L92'>92</a>
<a name='L93'></a><a href='#L93'>93</a>
<a name='L94'></a><a href='#L94'>94</a>
<a name='L95'></a><a href='#L95'>95</a>
<a name='L96'></a><a href='#L96'>96</a>
<a name='L97'></a><a href='#L97'>97</a>
<a name='L98'></a><a href='#L98'>98</a>
<a name='L99'></a><a href='#L99'>99</a>
<a name='L100'></a><a href='#L100'>100</a>
<a name='L101'></a><a href='#L101'>101</a>
<a name='L102'></a><a href='#L102'>102</a>
<a name='L103'></a><a href='#L103'>103</a>
<a name='L104'></a><a href='#L104'>104</a>
<a name='L105'></a><a href='#L105'>105</a>
<a name='L106'></a><a href='#L106'>106</a>
<a name='L107'></a><a href='#L107'>107</a>
<a name='L108'></a><a href='#L108'>108</a>
<a name='L109'></a><a href='#L109'>109</a>
<a name='L110'></a><a href='#L110'>110</a>
<a name='L111'></a><a href='#L111'>111</a>
<a name='L112'></a><a href='#L112'>112</a>
<a name='L113'></a><a href='#L113'>113</a>
<a name='L114'></a><a href='#L114'>114</a>
<a name='L115'></a><a href='#L115'>115</a>
<a name='L116'></a><a href='#L116'>116</a>
<a name='L117'></a><a href='#L117'>117</a>
<a name='L118'></a><a href='#L118'>118</a>
<a name='L119'></a><a href='#L119'>119</a>
<a name='L120'></a><a href='#L120'>120</a>
<a name='L121'></a><a href='#L121'>121</a>
<a name='L122'></a><a href='#L122'>122</a>
<a name='L123'></a><a href='#L123'>123</a>
<a name='L124'></a><a href='#L124'>124</a>
<a name='L125'></a><a href='#L125'>125</a>
<a name='L126'></a><a href='#L126'>126</a>
<a name='L127'></a><a href='#L127'>127</a>
<a name='L128'></a><a href='#L128'>128</a>
<a name='L129'></a><a href='#L129'>129</a>
<a name='L130'></a><a href='#L130'>130</a>
<a name='L131'></a><a href='#L131'>131</a>
<a name='L132'></a><a href='#L132'>132</a>
<a name='L133'></a><a href='#L133'>133</a>
<a name='L134'></a><a href='#L134'>134</a>
<a name='L135'></a><a href='#L135'>135</a>
<a name='L136'></a><a href='#L136'>136</a>
<a name='L137'></a><a href='#L137'>137</a>
<a name='L138'></a><a href='#L138'>138</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">23x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import chalk from 'chalk';
import logSymbols from 'log-symbols';
&nbsp;
// Icons for commands
export const icons: Record&lt;string, string&gt; = {
goto: '→',
click: '◉',
type: '⌨',
query: '?',
screenshot: '📷',
url: '🔗',
html: '&lt;&gt;',
back: '←',
forward: '→',
reload: '↻',
wait: '⏳',
newpage: '+',
close: '✕',
eval: '⚡',
};
&nbsp;
// Colors for command types
export const cmdColor: Record&lt;string, (s: string) =&gt; string&gt; = {
goto: chalk.cyan,
click: chalk.yellow,
type: chalk.magenta,
query: chalk.blue,
screenshot: chalk.green,
url: chalk.cyan,
html: chalk.blue,
back: chalk.yellow,
forward: chalk.yellow,
reload: chalk.yellow,
wait: chalk.gray,
newpage: chalk.green,
close: chalk.red,
eval: chalk.magenta,
};
&nbsp;
export function ts(): string {
return chalk.gray(`[${new Date().toISOString()}]`);
}
&nbsp;
export function truncate(str: string, max: number): string {
return str.length &gt; max ? `${str.slice(0, max)}...` : str;
}
&nbsp;
export interface CommandLike {
cmd: string;
url?: string;
selector?: string;
text?: string;
path?: string;
full?: boolean;
ms?: number;
script?: string;
}
&nbsp;
export function getCommandDetail(cmd: CommandLike): string | undefined {
switch (cmd.cmd) {
case 'goto':
return chalk.white(cmd.url);
case 'click':
case 'query':
return chalk.white(cmd.selector);
case 'type':
return `${chalk.white(cmd.selector)} ${chalk.dim(`="${cmd.text}"`)}`;
case 'screenshot':
return chalk.dim(cmd.path || 'screenshot.png');
case 'html':
return cmd.full ? <span class="branch-0 cbranch-no" title="branch not covered" >chalk.dim('(full)') : u</span>ndefined;
case 'wait':
return chalk.dim(`${cmd.ms || <span class="branch-1 cbranch-no" title="branch not covered" >1000}</span>ms`);
<span class="branch-7 cbranch-no" title="branch not covered" > case 'eval':</span>
<span class="cstat-no" title="statement not covered" > return chalk.dim(truncate(cmd.script || '', 50));</span>
default:
return undefined;
}
}
&nbsp;
export function formatCommand(cmd: CommandLike): string {
const color = cmdColor[cmd.cmd] || <span class="branch-1 cbranch-no" title="branch not covered" >chalk.white;</span>
const icon = icons[cmd.cmd] || <span class="branch-1 cbranch-no" title="branch not covered" >'•';</span>
const detail = getCommandDetail(cmd);
const suffix = detail ? ` ${detail}` : '';
return `${ts()} ${chalk.bold(color(icon))} ${color(cmd.cmd.toUpperCase())}${suffix}`;
}
&nbsp;
export interface ResultLike {
ok: boolean;
error?: string;
title?: string;
url?: string;
count?: number;
path?: string;
html?: string;
result?: unknown;
}
&nbsp;
const resultFormatters: Record&lt;string, (r: ResultLike) =&gt; string | undefined&gt; = {
goto: (r) =&gt; r.title,
click: (r) =&gt; (r.url ? `→ ${r.url}` : <span class="branch-1 cbranch-no" title="branch not covered" >undefined),</span>
query: (r) =&gt; (r.count !== undefined ? `Found ${r.count} element(s)` : <span class="branch-1 cbranch-no" title="branch not covered" >undefined),</span>
screenshot: <span class="fstat-no" title="function not covered" >(r</span>) =&gt; (<span class="cstat-no" title="statement not covered" >r.path ? `Saved to ${r.path}` : undefined),</span>
url: (r) =&gt; r.url,
html: (r) =&gt; (r.html !== undefined ? `${r.html.length} chars` : <span class="branch-1 cbranch-no" title="branch not covered" >undefined),</span>
eval: <span class="fstat-no" title="function not covered" >(r</span>) =&gt; (<span class="cstat-no" title="statement not covered" >r.result !== undefined ? truncate(JSON.stringify(r.result), 80) : undefined),</span>
};
&nbsp;
export function formatResult(cmd: CommandLike, result: ResultLike): string {
if (!result.ok) {
return `${ts()} ${logSymbols.error} ${chalk.red(result.error)}`;
}
const formatter = resultFormatters[cmd.cmd];
const msg = formatter ? formatter(result) : undefined;
const suffix = msg ? ` ${chalk.dim(msg)}` : '';
return `${ts()} ${logSymbols.success}${suffix}`;
}
&nbsp;
export type LogFn = (msg: string) =&gt; void;
&nbsp;
export function createLogger(logFn: LogFn = console.log) {
return {
command(cmd: CommandLike): void {
logFn(formatCommand(cmd));
},
result(cmd: CommandLike, result: ResultLike): void {
logFn(formatResult(cmd, result));
},
};
}
&nbsp;
// Default logger to stdout
export const logger = createLogger();
&nbsp;
// Logger to stderr (for MCP)
export const stderrLogger = createLogger(<span class="fstat-no" title="function not covered" >(m</span>sg) =&gt; <span class="cstat-no" title="statement not covered" >process.stderr.write(`${msg}\n`))</span>;
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-02-06T20:43:25.074Z
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
File diff suppressed because one or more lines are too long
+418
View File
@@ -0,0 +1,418 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for server.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="index.html">All files</a> server.ts</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">44.23% </span>
<span class="quiet">Statements</span>
<span class='fraction'>23/52</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">70% </span>
<span class="quiet">Branches</span>
<span class='fraction'>7/10</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">61.53% </span>
<span class="quiet">Functions</span>
<span class='fraction'>8/13</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">43.13% </span>
<span class="quiet">Lines</span>
<span class='fraction'>22/51</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a>
<a name='L19'></a><a href='#L19'>19</a>
<a name='L20'></a><a href='#L20'>20</a>
<a name='L21'></a><a href='#L21'>21</a>
<a name='L22'></a><a href='#L22'>22</a>
<a name='L23'></a><a href='#L23'>23</a>
<a name='L24'></a><a href='#L24'>24</a>
<a name='L25'></a><a href='#L25'>25</a>
<a name='L26'></a><a href='#L26'>26</a>
<a name='L27'></a><a href='#L27'>27</a>
<a name='L28'></a><a href='#L28'>28</a>
<a name='L29'></a><a href='#L29'>29</a>
<a name='L30'></a><a href='#L30'>30</a>
<a name='L31'></a><a href='#L31'>31</a>
<a name='L32'></a><a href='#L32'>32</a>
<a name='L33'></a><a href='#L33'>33</a>
<a name='L34'></a><a href='#L34'>34</a>
<a name='L35'></a><a href='#L35'>35</a>
<a name='L36'></a><a href='#L36'>36</a>
<a name='L37'></a><a href='#L37'>37</a>
<a name='L38'></a><a href='#L38'>38</a>
<a name='L39'></a><a href='#L39'>39</a>
<a name='L40'></a><a href='#L40'>40</a>
<a name='L41'></a><a href='#L41'>41</a>
<a name='L42'></a><a href='#L42'>42</a>
<a name='L43'></a><a href='#L43'>43</a>
<a name='L44'></a><a href='#L44'>44</a>
<a name='L45'></a><a href='#L45'>45</a>
<a name='L46'></a><a href='#L46'>46</a>
<a name='L47'></a><a href='#L47'>47</a>
<a name='L48'></a><a href='#L48'>48</a>
<a name='L49'></a><a href='#L49'>49</a>
<a name='L50'></a><a href='#L50'>50</a>
<a name='L51'></a><a href='#L51'>51</a>
<a name='L52'></a><a href='#L52'>52</a>
<a name='L53'></a><a href='#L53'>53</a>
<a name='L54'></a><a href='#L54'>54</a>
<a name='L55'></a><a href='#L55'>55</a>
<a name='L56'></a><a href='#L56'>56</a>
<a name='L57'></a><a href='#L57'>57</a>
<a name='L58'></a><a href='#L58'>58</a>
<a name='L59'></a><a href='#L59'>59</a>
<a name='L60'></a><a href='#L60'>60</a>
<a name='L61'></a><a href='#L61'>61</a>
<a name='L62'></a><a href='#L62'>62</a>
<a name='L63'></a><a href='#L63'>63</a>
<a name='L64'></a><a href='#L64'>64</a>
<a name='L65'></a><a href='#L65'>65</a>
<a name='L66'></a><a href='#L66'>66</a>
<a name='L67'></a><a href='#L67'>67</a>
<a name='L68'></a><a href='#L68'>68</a>
<a name='L69'></a><a href='#L69'>69</a>
<a name='L70'></a><a href='#L70'>70</a>
<a name='L71'></a><a href='#L71'>71</a>
<a name='L72'></a><a href='#L72'>72</a>
<a name='L73'></a><a href='#L73'>73</a>
<a name='L74'></a><a href='#L74'>74</a>
<a name='L75'></a><a href='#L75'>75</a>
<a name='L76'></a><a href='#L76'>76</a>
<a name='L77'></a><a href='#L77'>77</a>
<a name='L78'></a><a href='#L78'>78</a>
<a name='L79'></a><a href='#L79'>79</a>
<a name='L80'></a><a href='#L80'>80</a>
<a name='L81'></a><a href='#L81'>81</a>
<a name='L82'></a><a href='#L82'>82</a>
<a name='L83'></a><a href='#L83'>83</a>
<a name='L84'></a><a href='#L84'>84</a>
<a name='L85'></a><a href='#L85'>85</a>
<a name='L86'></a><a href='#L86'>86</a>
<a name='L87'></a><a href='#L87'>87</a>
<a name='L88'></a><a href='#L88'>88</a>
<a name='L89'></a><a href='#L89'>89</a>
<a name='L90'></a><a href='#L90'>90</a>
<a name='L91'></a><a href='#L91'>91</a>
<a name='L92'></a><a href='#L92'>92</a>
<a name='L93'></a><a href='#L93'>93</a>
<a name='L94'></a><a href='#L94'>94</a>
<a name='L95'></a><a href='#L95'>95</a>
<a name='L96'></a><a href='#L96'>96</a>
<a name='L97'></a><a href='#L97'>97</a>
<a name='L98'></a><a href='#L98'>98</a>
<a name='L99'></a><a href='#L99'>99</a>
<a name='L100'></a><a href='#L100'>100</a>
<a name='L101'></a><a href='#L101'>101</a>
<a name='L102'></a><a href='#L102'>102</a>
<a name='L103'></a><a href='#L103'>103</a>
<a name='L104'></a><a href='#L104'>104</a>
<a name='L105'></a><a href='#L105'>105</a>
<a name='L106'></a><a href='#L106'>106</a>
<a name='L107'></a><a href='#L107'>107</a>
<a name='L108'></a><a href='#L108'>108</a>
<a name='L109'></a><a href='#L109'>109</a>
<a name='L110'></a><a href='#L110'>110</a>
<a name='L111'></a><a href='#L111'>111</a>
<a name='L112'></a><a href='#L112'>112</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import chalk from 'chalk';
import express, { type Request, type Response } from 'express';
import logSymbols from 'log-symbols';
import { ClaudeBrowser } from './browser.js';
import { logger, ts } from './logger.js';
import type { BrowserCommand, BrowserOptions } from './types.js';
&nbsp;
export interface ServerOptions extends BrowserOptions {
port?: number;
}
&nbsp;
function <span class="fstat-no" title="function not covered" >printBanner(p</span>ort: number): void {
<span class="cstat-no" title="statement not covered" > console.log();</span>
<span class="cstat-no" title="statement not covered" > console.log(chalk.cyan.bold(' 🌐 Claude Browse Server'));</span>
<span class="cstat-no" title="statement not covered" > console.log(chalk.dim(' ─────────────────────────'));</span>
<span class="cstat-no" title="statement not covered" > console.log(` ${logSymbols.success} Listening on ${chalk.bold(`http://localhost:${port}`)}`);</span>
<span class="cstat-no" title="statement not covered" > console.log();</span>
<span class="cstat-no" title="statement not covered" > console.log(chalk.dim(' Commands:'));</span>
<span class="cstat-no" title="statement not covered" > console.log(</span>
` ${chalk.cyan('goto')} ${chalk.yellow('click')} ${chalk.magenta('type')} ${chalk.blue('query')} ${chalk.green('screenshot')}`
);
<span class="cstat-no" title="statement not covered" > console.log(</span>
` ${chalk.cyan('url')} ${chalk.blue('html')} ${chalk.yellow('back')} ${chalk.yellow('forward')} ${chalk.yellow('reload')} ${chalk.gray('wait')} ${chalk.red('close')}`
);
<span class="cstat-no" title="statement not covered" > console.log();</span>
<span class="cstat-no" title="statement not covered" > console.log(chalk.dim(' Example:'));</span>
<span class="cstat-no" title="statement not covered" > console.log(</span>
chalk.gray(` curl -X POST localhost:${port} -d '{"cmd":"goto","url":"https://example.com"}'`)
);
<span class="cstat-no" title="statement not covered" > console.log();</span>
}
&nbsp;
export class BrowserServer {
private browser: ClaudeBrowser;
private app = express();
private server: ReturnType&lt;typeof this.app.listen&gt; | null = null;
private port: number;
&nbsp;
constructor(options: ServerOptions = {}) {
this.browser = new ClaudeBrowser(options);
this.port = options.port ?? 13373;
this.setupMiddleware();
this.setupRoutes();
}
&nbsp;
private setupMiddleware(): void {
this.app.use(express.json());
this.app.use(express.text({ type: '*/*' }));
}
&nbsp;
private setupRoutes(): void {
this.app.post('/', (req, res) =&gt; this.handleCommand(req, res));
}
&nbsp;
private async handleCommand(req: Request, res: Response): Promise&lt;void&gt; {
try {
const cmd: BrowserCommand = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
logger.command(cmd);
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (cmd.cmd === 'close') {
<span class="cstat-no" title="statement not covered" > logger.result(cmd, { ok: true });</span>
<span class="cstat-no" title="statement not covered" > res.json({ ok: true });</span>
<span class="cstat-no" title="statement not covered" > await this.stop();</span>
<span class="cstat-no" title="statement not covered" > process.exit(0);</span>
}
&nbsp;
const result = await this.browser.executeCommand(cmd);
logger.result(cmd, result);
res.json(result);
} catch (err) {
const error = (<span class="cstat-no" title="statement not covered" >err as Error).message;</span>
<span class="cstat-no" title="statement not covered" > console.log(`${ts()} ${logSymbols.error} ${chalk.red(error)}`);</span>
<span class="cstat-no" title="statement not covered" > res.status(500).json({ ok: false, error });</span>
}
}
&nbsp;
async <span class="fstat-no" title="function not covered" >start(): Promise&lt;void&gt; {</span>
<span class="cstat-no" title="statement not covered" > await this.browser.launch();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return new Promise(<span class="fstat-no" title="function not covered" >(r</span>esolve) =&gt; {</span>
<span class="cstat-no" title="statement not covered" > this.server = this.app.listen(this.port, <span class="fstat-no" title="function not covered" >() =&gt; {</span></span>
<span class="cstat-no" title="statement not covered" > printBanner(this.port);</span>
<span class="cstat-no" title="statement not covered" > resolve();</span>
});
});
}
&nbsp;
async stop(): Promise&lt;void&gt; {
console.log(chalk.dim('\n Shutting down...'));
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.server) {
<span class="cstat-no" title="statement not covered" > this.server.close();</span>
<span class="cstat-no" title="statement not covered" > this.server = null;</span>
}
await this.browser.close();
console.log(` ${logSymbols.success} Browser closed\n`);
}
&nbsp;
getPort(): number {
return this.port;
}
&nbsp;
getApp() {
return this.app;
}
}
&nbsp;
export async function <span class="fstat-no" title="function not covered" >startServer(o</span>ptions: ServerOptions = <span class="branch-0 cbranch-no" title="branch not covered" >{}): Promise&lt;BrowserServer&gt; {</span>
const server = <span class="cstat-no" title="statement not covered" >new BrowserServer(options);</span>
<span class="cstat-no" title="statement not covered" > await server.start();</span>
<span class="cstat-no" title="statement not covered" > return server;</span>
}
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-02-06T20:43:25.074Z
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

+210
View File
@@ -0,0 +1,210 @@
/* eslint-disable */
var addSorting = (function() {
'use strict';
var cols,
currentSort = {
index: 0,
desc: false
};
// returns the summary table element
function getTable() {
return document.querySelector('.coverage-summary');
}
// returns the thead element of the summary table
function getTableHeader() {
return getTable().querySelector('thead tr');
}
// returns the tbody element of the summary table
function getTableBody() {
return getTable().querySelector('tbody');
}
// returns the th element for nth column
function getNthColumn(n) {
return getTableHeader().querySelectorAll('th')[n];
}
function onFilterInput() {
const searchValue = document.getElementById('fileSearch').value;
const rows = document.getElementsByTagName('tbody')[0].children;
// Try to create a RegExp from the searchValue. If it fails (invalid regex),
// it will be treated as a plain text search
let searchRegex;
try {
searchRegex = new RegExp(searchValue, 'i'); // 'i' for case-insensitive
} catch (error) {
searchRegex = null;
}
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
let isMatch = false;
if (searchRegex) {
// If a valid regex was created, use it for matching
isMatch = searchRegex.test(row.textContent);
} else {
// Otherwise, fall back to the original plain text search
isMatch = row.textContent
.toLowerCase()
.includes(searchValue.toLowerCase());
}
row.style.display = isMatch ? '' : 'none';
}
}
// loads the search box
function addSearchBox() {
var template = document.getElementById('filterTemplate');
var templateClone = template.content.cloneNode(true);
templateClone.getElementById('fileSearch').oninput = onFilterInput;
template.parentElement.appendChild(templateClone);
}
// loads all columns
function loadColumns() {
var colNodes = getTableHeader().querySelectorAll('th'),
colNode,
cols = [],
col,
i;
for (i = 0; i < colNodes.length; i += 1) {
colNode = colNodes[i];
col = {
key: colNode.getAttribute('data-col'),
sortable: !colNode.getAttribute('data-nosort'),
type: colNode.getAttribute('data-type') || 'string'
};
cols.push(col);
if (col.sortable) {
col.defaultDescSort = col.type === 'number';
colNode.innerHTML =
colNode.innerHTML + '<span class="sorter"></span>';
}
}
return cols;
}
// attaches a data attribute to every tr element with an object
// of data values keyed by column name
function loadRowData(tableRow) {
var tableCols = tableRow.querySelectorAll('td'),
colNode,
col,
data = {},
i,
val;
for (i = 0; i < tableCols.length; i += 1) {
colNode = tableCols[i];
col = cols[i];
val = colNode.getAttribute('data-value');
if (col.type === 'number') {
val = Number(val);
}
data[col.key] = val;
}
return data;
}
// loads all row data
function loadData() {
var rows = getTableBody().querySelectorAll('tr'),
i;
for (i = 0; i < rows.length; i += 1) {
rows[i].data = loadRowData(rows[i]);
}
}
// sorts the table using the data for the ith column
function sortByIndex(index, desc) {
var key = cols[index].key,
sorter = function(a, b) {
a = a.data[key];
b = b.data[key];
return a < b ? -1 : a > b ? 1 : 0;
},
finalSorter = sorter,
tableBody = document.querySelector('.coverage-summary tbody'),
rowNodes = tableBody.querySelectorAll('tr'),
rows = [],
i;
if (desc) {
finalSorter = function(a, b) {
return -1 * sorter(a, b);
};
}
for (i = 0; i < rowNodes.length; i += 1) {
rows.push(rowNodes[i]);
tableBody.removeChild(rowNodes[i]);
}
rows.sort(finalSorter);
for (i = 0; i < rows.length; i += 1) {
tableBody.appendChild(rows[i]);
}
}
// removes sort indicators for current column being sorted
function removeSortIndicators() {
var col = getNthColumn(currentSort.index),
cls = col.className;
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
col.className = cls;
}
// adds sort indicators for current column being sorted
function addSortIndicators() {
getNthColumn(currentSort.index).className += currentSort.desc
? ' sorted-desc'
: ' sorted';
}
// adds event listeners for all sorter widgets
function enableUI() {
var i,
el,
ithSorter = function ithSorter(i) {
var col = cols[i];
return function() {
var desc = col.defaultDescSort;
if (currentSort.index === i) {
desc = !currentSort.desc;
}
sortByIndex(i, desc);
removeSortIndicators();
currentSort.index = i;
currentSort.desc = desc;
addSortIndicators();
};
};
for (i = 0; i < cols.length; i += 1) {
if (cols[i].sortable) {
// add the click event handler on the th so users
// dont have to click on those tiny arrows
el = getNthColumn(i).querySelector('.sorter').parentElement;
if (el.addEventListener) {
el.addEventListener('click', ithSorter(i));
} else {
el.attachEvent('onclick', ithSorter(i));
}
}
}
}
// adds sorting functionality to the UI
return function() {
if (!getTable()) {
return;
}
cols = loadColumns();
loadData();
addSearchBox();
addSortIndicators();
enableUI();
};
})();
window.addEventListener('load', addSorting);
+424
View File
@@ -0,0 +1,424 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for types.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="index.html">All files</a> types.ts</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Statements</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Lines</span>
<span class='fraction'>0/0</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a>
<a name='L19'></a><a href='#L19'>19</a>
<a name='L20'></a><a href='#L20'>20</a>
<a name='L21'></a><a href='#L21'>21</a>
<a name='L22'></a><a href='#L22'>22</a>
<a name='L23'></a><a href='#L23'>23</a>
<a name='L24'></a><a href='#L24'>24</a>
<a name='L25'></a><a href='#L25'>25</a>
<a name='L26'></a><a href='#L26'>26</a>
<a name='L27'></a><a href='#L27'>27</a>
<a name='L28'></a><a href='#L28'>28</a>
<a name='L29'></a><a href='#L29'>29</a>
<a name='L30'></a><a href='#L30'>30</a>
<a name='L31'></a><a href='#L31'>31</a>
<a name='L32'></a><a href='#L32'>32</a>
<a name='L33'></a><a href='#L33'>33</a>
<a name='L34'></a><a href='#L34'>34</a>
<a name='L35'></a><a href='#L35'>35</a>
<a name='L36'></a><a href='#L36'>36</a>
<a name='L37'></a><a href='#L37'>37</a>
<a name='L38'></a><a href='#L38'>38</a>
<a name='L39'></a><a href='#L39'>39</a>
<a name='L40'></a><a href='#L40'>40</a>
<a name='L41'></a><a href='#L41'>41</a>
<a name='L42'></a><a href='#L42'>42</a>
<a name='L43'></a><a href='#L43'>43</a>
<a name='L44'></a><a href='#L44'>44</a>
<a name='L45'></a><a href='#L45'>45</a>
<a name='L46'></a><a href='#L46'>46</a>
<a name='L47'></a><a href='#L47'>47</a>
<a name='L48'></a><a href='#L48'>48</a>
<a name='L49'></a><a href='#L49'>49</a>
<a name='L50'></a><a href='#L50'>50</a>
<a name='L51'></a><a href='#L51'>51</a>
<a name='L52'></a><a href='#L52'>52</a>
<a name='L53'></a><a href='#L53'>53</a>
<a name='L54'></a><a href='#L54'>54</a>
<a name='L55'></a><a href='#L55'>55</a>
<a name='L56'></a><a href='#L56'>56</a>
<a name='L57'></a><a href='#L57'>57</a>
<a name='L58'></a><a href='#L58'>58</a>
<a name='L59'></a><a href='#L59'>59</a>
<a name='L60'></a><a href='#L60'>60</a>
<a name='L61'></a><a href='#L61'>61</a>
<a name='L62'></a><a href='#L62'>62</a>
<a name='L63'></a><a href='#L63'>63</a>
<a name='L64'></a><a href='#L64'>64</a>
<a name='L65'></a><a href='#L65'>65</a>
<a name='L66'></a><a href='#L66'>66</a>
<a name='L67'></a><a href='#L67'>67</a>
<a name='L68'></a><a href='#L68'>68</a>
<a name='L69'></a><a href='#L69'>69</a>
<a name='L70'></a><a href='#L70'>70</a>
<a name='L71'></a><a href='#L71'>71</a>
<a name='L72'></a><a href='#L72'>72</a>
<a name='L73'></a><a href='#L73'>73</a>
<a name='L74'></a><a href='#L74'>74</a>
<a name='L75'></a><a href='#L75'>75</a>
<a name='L76'></a><a href='#L76'>76</a>
<a name='L77'></a><a href='#L77'>77</a>
<a name='L78'></a><a href='#L78'>78</a>
<a name='L79'></a><a href='#L79'>79</a>
<a name='L80'></a><a href='#L80'>80</a>
<a name='L81'></a><a href='#L81'>81</a>
<a name='L82'></a><a href='#L82'>82</a>
<a name='L83'></a><a href='#L83'>83</a>
<a name='L84'></a><a href='#L84'>84</a>
<a name='L85'></a><a href='#L85'>85</a>
<a name='L86'></a><a href='#L86'>86</a>
<a name='L87'></a><a href='#L87'>87</a>
<a name='L88'></a><a href='#L88'>88</a>
<a name='L89'></a><a href='#L89'>89</a>
<a name='L90'></a><a href='#L90'>90</a>
<a name='L91'></a><a href='#L91'>91</a>
<a name='L92'></a><a href='#L92'>92</a>
<a name='L93'></a><a href='#L93'>93</a>
<a name='L94'></a><a href='#L94'>94</a>
<a name='L95'></a><a href='#L95'>95</a>
<a name='L96'></a><a href='#L96'>96</a>
<a name='L97'></a><a href='#L97'>97</a>
<a name='L98'></a><a href='#L98'>98</a>
<a name='L99'></a><a href='#L99'>99</a>
<a name='L100'></a><a href='#L100'>100</a>
<a name='L101'></a><a href='#L101'>101</a>
<a name='L102'></a><a href='#L102'>102</a>
<a name='L103'></a><a href='#L103'>103</a>
<a name='L104'></a><a href='#L104'>104</a>
<a name='L105'></a><a href='#L105'>105</a>
<a name='L106'></a><a href='#L106'>106</a>
<a name='L107'></a><a href='#L107'>107</a>
<a name='L108'></a><a href='#L108'>108</a>
<a name='L109'></a><a href='#L109'>109</a>
<a name='L110'></a><a href='#L110'>110</a>
<a name='L111'></a><a href='#L111'>111</a>
<a name='L112'></a><a href='#L112'>112</a>
<a name='L113'></a><a href='#L113'>113</a>
<a name='L114'></a><a href='#L114'>114</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">export interface BrowserOptions {
headless?: boolean;
width?: number;
height?: number;
}
&nbsp;
export interface ElementInfo {
tag: string;
text: string;
attributes: Record&lt;string, string&gt;;
}
&nbsp;
// Command types
export interface GotoCommand {
cmd: 'goto';
url: string;
}
&nbsp;
export interface ClickCommand {
cmd: 'click';
selector: string;
}
&nbsp;
export interface TypeCommand {
cmd: 'type';
selector: string;
text: string;
}
&nbsp;
export interface QueryCommand {
cmd: 'query';
selector: string;
}
&nbsp;
export interface ScreenshotCommand {
cmd: 'screenshot';
path?: string;
fullPage?: boolean;
}
&nbsp;
export interface UrlCommand {
cmd: 'url';
}
&nbsp;
export interface HtmlCommand {
cmd: 'html';
full?: boolean;
}
&nbsp;
export interface BackCommand {
cmd: 'back';
}
&nbsp;
export interface ForwardCommand {
cmd: 'forward';
}
&nbsp;
export interface ReloadCommand {
cmd: 'reload';
}
&nbsp;
export interface WaitCommand {
cmd: 'wait';
ms?: number;
}
&nbsp;
export interface NewPageCommand {
cmd: 'newpage';
}
&nbsp;
export interface CloseCommand {
cmd: 'close';
}
&nbsp;
export interface EvalCommand {
cmd: 'eval';
script: string;
}
&nbsp;
export type BrowserCommand =
| GotoCommand
| ClickCommand
| TypeCommand
| QueryCommand
| ScreenshotCommand
| UrlCommand
| HtmlCommand
| BackCommand
| ForwardCommand
| ReloadCommand
| WaitCommand
| NewPageCommand
| CloseCommand
| EvalCommand;
&nbsp;
// Response types
export interface SuccessResponse {
ok: true;
url?: string;
title?: string;
path?: string;
html?: string;
count?: number;
elements?: ElementInfo[];
result?: unknown;
}
&nbsp;
export interface ErrorResponse {
ok: false;
error: string;
}
&nbsp;
export type CommandResponse = SuccessResponse | ErrorResponse;
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-02-06T20:43:25.074Z
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>
+1982 -4
View File
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -20,6 +20,9 @@
"check": "biome check src/", "check": "biome check src/",
"fix": "biome check --write src/", "fix": "biome check --write src/",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"test:unit": "vitest run --coverage --passWithNoTests",
"test:watch": "vitest",
"test": "npm run fix && npm run typecheck && npm run test:unit && npm run build",
"prepublishOnly": "npm run build" "prepublishOnly": "npm run build"
}, },
"keywords": [ "keywords": [
@@ -52,7 +55,11 @@
"@biomejs/biome": "^1.9.0", "@biomejs/biome": "^1.9.0",
"@types/express": "^5.0.6", "@types/express": "^5.0.6",
"@types/node": "^20.11.0", "@types/node": "^20.11.0",
"typescript": "^5.3.0" "@types/supertest": "^6.0.3",
"@vitest/coverage-v8": "^4.0.18",
"supertest": "^7.2.2",
"typescript": "^5.3.0",
"vitest": "^4.0.18"
}, },
"files": [ "files": [
"dist", "dist",
+90
View File
@@ -0,0 +1,90 @@
import { describe, expect, it } from 'vitest';
import { ClaudeBrowser } from './browser.js';
describe('ClaudeBrowser', () => {
describe('constructor', () => {
it('creates browser with default options', () => {
const browser = new ClaudeBrowser();
expect(browser).toBeInstanceOf(ClaudeBrowser);
});
it('accepts custom options', () => {
const browser = new ClaudeBrowser({
headless: false,
width: 1920,
height: 1080,
});
expect(browser).toBeInstanceOf(ClaudeBrowser);
});
});
describe('ensurePage (via executeCommand)', () => {
it('throws error when browser not launched', async () => {
const browser = new ClaudeBrowser();
const result = await browser.executeCommand({ cmd: 'url' });
expect(result.ok).toBe(false);
if (!result.ok) {
expect(result.error).toContain('Browser not launched');
}
});
});
describe('executeCommand', () => {
it('returns error for commands without launch', async () => {
const browser = new ClaudeBrowser();
const gotoResult = await browser.executeCommand({ cmd: 'goto', url: 'https://example.com' });
expect(gotoResult.ok).toBe(false);
const clickResult = await browser.executeCommand({ cmd: 'click', selector: '#btn' });
expect(clickResult.ok).toBe(false);
const typeResult = await browser.executeCommand({
cmd: 'type',
selector: '#input',
text: 'test',
});
expect(typeResult.ok).toBe(false);
const queryResult = await browser.executeCommand({ cmd: 'query', selector: '.item' });
expect(queryResult.ok).toBe(false);
const screenshotResult = await browser.executeCommand({ cmd: 'screenshot' });
expect(screenshotResult.ok).toBe(false);
const htmlResult = await browser.executeCommand({ cmd: 'html' });
expect(htmlResult.ok).toBe(false);
const backResult = await browser.executeCommand({ cmd: 'back' });
expect(backResult.ok).toBe(false);
const forwardResult = await browser.executeCommand({ cmd: 'forward' });
expect(forwardResult.ok).toBe(false);
const reloadResult = await browser.executeCommand({ cmd: 'reload' });
expect(reloadResult.ok).toBe(false);
const waitResult = await browser.executeCommand({ cmd: 'wait', ms: 100 });
expect(waitResult.ok).toBe(false);
const evalResult = await browser.executeCommand({ cmd: 'eval', script: '1+1' });
expect(evalResult.ok).toBe(false);
});
it('handles close command without error when not launched', async () => {
const browser = new ClaudeBrowser();
const result = await browser.executeCommand({ cmd: 'close' });
expect(result.ok).toBe(true);
});
it('handles newpage command error when not launched', async () => {
const browser = new ClaudeBrowser();
const result = await browser.executeCommand({ cmd: 'newpage' });
expect(result.ok).toBe(false);
if (!result.ok) {
expect(result.error).toContain('Browser not launched');
}
});
});
});
+125
View File
@@ -0,0 +1,125 @@
import { describe, expect, it, vi } from 'vitest';
import {
createLogger,
formatCommand,
formatResult,
getCommandDetail,
icons,
truncate,
} from './logger.js';
describe('truncate', () => {
it('returns string unchanged if shorter than max', () => {
expect(truncate('hello', 10)).toBe('hello');
});
it('truncates and adds ellipsis if longer than max', () => {
expect(truncate('hello world', 5)).toBe('hello...');
});
it('handles exact length', () => {
expect(truncate('hello', 5)).toBe('hello');
});
});
describe('icons', () => {
it('has icon for each command type', () => {
expect(icons.goto).toBe('→');
expect(icons.click).toBe('◉');
expect(icons.type).toBe('⌨');
expect(icons.screenshot).toBe('📷');
});
});
describe('getCommandDetail', () => {
it('returns url for goto command', () => {
const result = getCommandDetail({ cmd: 'goto', url: 'https://example.com' });
expect(result).toContain('https://example.com');
});
it('returns selector for click command', () => {
const result = getCommandDetail({ cmd: 'click', selector: '#btn' });
expect(result).toContain('#btn');
});
it('returns selector and text for type command', () => {
const result = getCommandDetail({ cmd: 'type', selector: '#input', text: 'hello' });
expect(result).toContain('#input');
expect(result).toContain('hello');
});
it('returns path for screenshot command', () => {
const result = getCommandDetail({ cmd: 'screenshot', path: 'test.png' });
expect(result).toContain('test.png');
});
it('returns default path when none provided for screenshot', () => {
const result = getCommandDetail({ cmd: 'screenshot' });
expect(result).toContain('screenshot.png');
});
it('returns undefined for url command', () => {
expect(getCommandDetail({ cmd: 'url' })).toBeUndefined();
});
it('returns ms for wait command', () => {
const result = getCommandDetail({ cmd: 'wait', ms: 500 });
expect(result).toContain('500');
});
});
describe('formatCommand', () => {
it('formats goto command', () => {
const result = formatCommand({ cmd: 'goto', url: 'https://example.com' });
expect(result).toContain('GOTO');
expect(result).toContain('https://example.com');
});
it('formats click command', () => {
const result = formatCommand({ cmd: 'click', selector: '#btn' });
expect(result).toContain('CLICK');
expect(result).toContain('#btn');
});
});
describe('formatResult', () => {
it('formats error result', () => {
const result = formatResult({ cmd: 'goto' }, { ok: false, error: 'Failed' });
expect(result).toContain('Failed');
});
it('formats successful goto result with title', () => {
const result = formatResult({ cmd: 'goto' }, { ok: true, title: 'Example' });
expect(result).toContain('Example');
});
it('formats query result with count', () => {
const result = formatResult({ cmd: 'query' }, { ok: true, count: 5 });
expect(result).toContain('5');
});
});
describe('createLogger', () => {
it('creates logger with custom log function', () => {
const logs: string[] = [];
const logFn = (msg: string) => logs.push(msg);
const logger = createLogger(logFn);
logger.command({ cmd: 'goto', url: 'https://example.com' });
expect(logs).toHaveLength(1);
expect(logs[0]).toContain('GOTO');
logger.result({ cmd: 'goto' }, { ok: true, title: 'Example' });
expect(logs).toHaveLength(2);
});
it('logs command and result', () => {
const spy = vi.fn();
const logger = createLogger(spy);
logger.command({ cmd: 'click', selector: '#btn' });
logger.result({ cmd: 'click' }, { ok: true, url: '/page' });
expect(spy).toHaveBeenCalledTimes(2);
});
});
+123
View File
@@ -0,0 +1,123 @@
import request from 'supertest';
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
import { BrowserServer } from './server.js';
// Mock the browser module
vi.mock('./browser.js', () => ({
ClaudeBrowser: class MockClaudeBrowser {
async launch() {}
async close() {}
async executeCommand(cmd: { cmd: string; url?: string }) {
switch (cmd.cmd) {
case 'goto':
return { ok: true, url: cmd.url, title: 'Test Page' };
case 'click':
return { ok: true, url: '/clicked' };
case 'type':
return { ok: true };
case 'query':
return { ok: true, count: 2, elements: [] };
case 'url':
return { ok: true, url: 'https://example.com', title: 'Example' };
case 'html':
return { ok: true, html: '<html></html>' };
default:
return { ok: true };
}
}
},
}));
describe('BrowserServer', () => {
let server: BrowserServer;
beforeAll(async () => {
server = new BrowserServer({ port: 0 }); // Use port 0 to get random available port
});
afterAll(async () => {
await server.stop();
});
describe('constructor', () => {
it('creates server with default port', () => {
const s = new BrowserServer();
expect(s.getPort()).toBe(13373);
});
it('creates server with custom port', () => {
const s = new BrowserServer({ port: 8080 });
expect(s.getPort()).toBe(8080);
});
});
describe('POST /', () => {
it('handles goto command', async () => {
const app = server.getApp();
const res = await request(app)
.post('/')
.send({ cmd: 'goto', url: 'https://example.com' })
.expect(200);
expect(res.body.ok).toBe(true);
expect(res.body.url).toBe('https://example.com');
expect(res.body.title).toBe('Test Page');
});
it('handles click command', async () => {
const app = server.getApp();
const res = await request(app).post('/').send({ cmd: 'click', selector: '#btn' }).expect(200);
expect(res.body.ok).toBe(true);
expect(res.body.url).toBe('/clicked');
});
it('handles type command', async () => {
const app = server.getApp();
const res = await request(app)
.post('/')
.send({ cmd: 'type', selector: '#input', text: 'hello' })
.expect(200);
expect(res.body.ok).toBe(true);
});
it('handles query command', async () => {
const app = server.getApp();
const res = await request(app)
.post('/')
.send({ cmd: 'query', selector: '.items' })
.expect(200);
expect(res.body.ok).toBe(true);
expect(res.body.count).toBe(2);
});
it('handles url command', async () => {
const app = server.getApp();
const res = await request(app).post('/').send({ cmd: 'url' }).expect(200);
expect(res.body.ok).toBe(true);
expect(res.body.url).toBe('https://example.com');
});
it('handles html command', async () => {
const app = server.getApp();
const res = await request(app).post('/').send({ cmd: 'html' }).expect(200);
expect(res.body.ok).toBe(true);
expect(res.body.html).toBe('<html></html>');
});
it('handles JSON string body', async () => {
const app = server.getApp();
const res = await request(app)
.post('/')
.set('Content-Type', 'text/plain')
.send(JSON.stringify({ cmd: 'url' }))
.expect(200);
expect(res.body.ok).toBe(true);
});
});
});
+12
View File
@@ -0,0 +1,12 @@
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
include: ['src/**/*.test.ts'],
coverage: {
provider: 'v8',
include: ['src/**/*.ts'],
exclude: ['src/**/*.test.ts', 'src/cli.ts', 'src/mcp.ts', 'src/index.ts'],
},
},
});