MCPcopy
hub / github.com/vitest-dev/vitest / findLongestFunctionLength

Function findLongestFunctionLength

packages/coverage-v8/src/provider.ts:466–475  ·  view source on GitHub ↗

* Find the function with highest `endOffset` to determine the length of the file

(functions: Profiler.FunctionCoverage[])

Source from the content-addressed store, hash-verified

464 * Find the function with highest `endOffset` to determine the length of the file
465 */
466function findLongestFunctionLength(functions: Profiler.FunctionCoverage[]) {
467 return functions.reduce((previous, current) => {
468 const maxEndOffset = current.ranges.reduce(
469 (endOffset, range) => Math.max(endOffset, range.endOffset),
470 0,
471 )
472
473 return Math.max(previous, maxEndOffset)
474 }, 0)
475}
476
477function removeStartsWith(filepath: string, start: string) {
478 if (filepath.startsWith(start)) {

Callers 1

getSourcesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected