mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 14:57:09 +01:00
Support path pattern to match test report files
This commit is contained in:
parent
dfddea6f3f
commit
656ede0390
2 changed files with 26 additions and 21 deletions
|
|
@ -1,24 +1,10 @@
|
|||
import * as fs from 'fs'
|
||||
|
||||
export function getFileContent(path: string): string {
|
||||
if (!fs.existsSync(path)) {
|
||||
throw new Error(`File '${path}' not found`)
|
||||
}
|
||||
|
||||
if (!fs.lstatSync(path).isFile()) {
|
||||
throw new Error(`'${path}' is not a file`)
|
||||
}
|
||||
|
||||
return fs.readFileSync(path, {encoding: 'utf8'})
|
||||
}
|
||||
|
||||
export function normalizeDirPath(path: string, trailingSeparator: boolean): string {
|
||||
export function normalizeDirPath(path: string, addTrailingSlash: boolean): string {
|
||||
if (!path) {
|
||||
return path
|
||||
}
|
||||
|
||||
path = normalizeFilePath(path)
|
||||
if (trailingSeparator && !path.endsWith('/')) {
|
||||
if (addTrailingSlash && !path.endsWith('/')) {
|
||||
path += '/'
|
||||
}
|
||||
return path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue