-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Ruby instructions * Handle relative paths in lcov files * Remove deprecated upload artifact action (not needed)
- Loading branch information
Showing
9 changed files
with
30 additions
and
20 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,13 +1,24 @@ | ||
import * as NodeUtil from 'util' | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
import {CoverageParsed} from './general' | ||
import parser from 'lcov-parse' | ||
|
||
export async function parseLCov(lcovPath: string): Promise<CoverageParsed> { | ||
export async function parseLCov( | ||
lcovPath: string, | ||
workspacePath: string | ||
): Promise<CoverageParsed> { | ||
if (!lcovPath) { | ||
throw Error('No LCov path provided') | ||
} | ||
|
||
const parserPromise = NodeUtil.promisify(parser) | ||
const fileRaw = fs.readFileSync(lcovPath, 'utf8') | ||
return parserPromise(fileRaw) as CoverageParsed | ||
const parsed = (await parserPromise(fileRaw)) as CoverageParsed | ||
|
||
for (const entry of parsed) { | ||
entry.file = path.relative(workspacePath, entry.file) | ||
} | ||
|
||
return parsed | ||
} |