mirror of
https://github.com/dorny/test-reporter.git
synced 2026-02-01 10:55:23 -08:00
Support path pattern to match test report files
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user