-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for cobertura format
- Loading branch information
Showing
13 changed files
with
454 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn commitlint --edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint && yarn pretty-quick --staged && yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
|
||
import { join } from 'node:path'; | ||
|
||
import { getTotalLines } from './getTotalLines.js'; | ||
import { CoberturaClass, CoberturaLine } from './types.js'; | ||
|
||
export async function setCoveredLinesCobertura( | ||
coveredLines: number[], | ||
uncoveredLines: number[], | ||
repoRoot: string, | ||
filePath: string, | ||
classObj: CoberturaClass | ||
): Promise<void> { | ||
const randomLines: number[] = []; | ||
const totalLines = await getTotalLines(join(repoRoot, filePath)); | ||
|
||
for (const coveredLine of coveredLines) { | ||
if (coveredLine > totalLines) { | ||
for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) { | ||
if ( | ||
!uncoveredLines.includes(randomLineNumber) && | ||
!coveredLines.includes(randomLineNumber) && | ||
!randomLines.includes(randomLineNumber) | ||
) { | ||
const randomLine: CoberturaLine = { | ||
'@number': randomLineNumber, | ||
'@hits': 1, | ||
'@branch': 'false', | ||
}; | ||
classObj.lines.line.push(randomLine); | ||
randomLines.push(randomLineNumber); | ||
break; | ||
} | ||
} | ||
} else { | ||
const coveredLineObj: CoberturaLine = { | ||
'@number': coveredLine, | ||
'@hits': 1, | ||
'@branch': 'false', | ||
}; | ||
classObj.lines.line.push(coveredLineObj); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.