• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ggilder / codecoverage / 14650332767

24 Apr 2025 07:45PM UTC coverage: 70.68% (-11.1%) from 81.763%
14650332767

push

github

web-flow
Update dependencies (#24)

72 of 110 branches covered (65.45%)

Branch coverage included in aggregate %.

5 of 13 new or added lines in 4 files covered. (38.46%)

13 existing lines in 3 files now uncovered.

292 of 405 relevant lines covered (72.1%)

3.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.44
/src/utils/gocoverage.ts
1
import * as fs from 'fs'
1✔
2
import * as gocov from 'golang-cover-parse'
1✔
3
import * as path from 'path'
1✔
4
import * as readline from 'readline'
1✔
5
import {CoverageParsed} from './general.js'
6

7
export async function parseGoCoverage(
3✔
8
  coveragePath: string,
3✔
9
  goModPath: string
3✔
10
): Promise<CoverageParsed> {
3✔
11
  if (!coveragePath) {
3✔
12
    throw Error('No Go coverage path provided')
1✔
13
  }
1✔
14

15
  if (!goModPath) {
3✔
16
    throw Error('No Go module path provided')
1✔
17
  }
1✔
18

19
  const goModule = await parseGoModFile(goModPath)
1✔
20

21
  const fileRaw = fs.readFileSync(coveragePath, 'utf8')
1✔
22
  return new Promise((resolve, reject) => {
1✔
23
    gocov.parseContent(fileRaw, (err, result) => {
1✔
24
      if (err === null) {
1✔
25
        filterModulePaths(result, goModule)
1✔
26
        resolve(result)
1✔
27
      }
1✔
28
      reject(err)
1✔
29
    })
1✔
30
  })
1✔
31
}
1✔
32

33
function filterModulePaths(entries, moduleName: string): void {
1✔
34
  for (const entry of entries) {
1✔
35
    entry.file = path.relative(moduleName, entry.file)
7✔
36
  }
7✔
37
}
1✔
38

39
async function parseGoModFile(filePath: string): Promise<string> {
1✔
40
  const fileStream = fs.createReadStream(filePath)
1✔
41
  const rl = readline.createInterface({
1✔
42
    input: fileStream,
1✔
43
    crlfDelay: Infinity
1✔
44
  })
1✔
45
  // Note: we use the crlfDelay option to recognize all instances of CR LF
46
  // ('\r\n') in input.txt as a single line break.
47

48
  for await (const line of rl) {
1✔
49
    if (line.startsWith('module ')) {
1✔
50
      return line.slice(7)
1✔
51
    }
1✔
52
  }
1!
53

54
  /* istanbul ignore next */
UNCOV
55
  return ''
×
UNCOV
56
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc