mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Support coma separated list of paths to test reports
This commit is contained in:
parent
40b5f476c7
commit
0ce114d684
3 changed files with 11 additions and 5 deletions
|
|
@ -49,9 +49,9 @@ jobs:
|
||||||
# Name of the Check Run which will be created
|
# Name of the Check Run which will be created
|
||||||
name: ''
|
name: ''
|
||||||
|
|
||||||
# Path to test report
|
# Coma separated list of paths to test reports
|
||||||
# Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
|
# Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
|
||||||
# Path may match multiple result files of same format
|
# All matched result files must be of same format
|
||||||
path: ''
|
path: ''
|
||||||
|
|
||||||
# Format of test report. Supported options:
|
# Format of test report. Supported options:
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ inputs:
|
||||||
description: Name of the check run
|
description: Name of the check run
|
||||||
required: true
|
required: true
|
||||||
path:
|
path:
|
||||||
description: Path to test report
|
description: |
|
||||||
|
Coma separated list of paths to test reports
|
||||||
|
Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
|
||||||
|
All matched files must be of same format
|
||||||
required: true
|
required: true
|
||||||
reporter:
|
reporter:
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
|
|
@ -90,14 +90,17 @@ function getParser(reporter: string): ParseTestResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getFiles(pattern: string): Promise<FileContent[]> {
|
export async function getFiles(pattern: string): Promise<FileContent[]> {
|
||||||
const paths = await glob(pattern, {dot: true})
|
const paths = (await Promise.all(pattern.split(',').map(async pat => glob(pat, {dot: true})))).flat()
|
||||||
return Promise.all(
|
|
||||||
|
const files = Promise.all(
|
||||||
paths.map(async path => {
|
paths.map(async path => {
|
||||||
core.info(`Reading test report '${path}'`)
|
core.info(`Reading test report '${path}'`)
|
||||||
const content = await fs.promises.readFile(path, {encoding: 'utf8'})
|
const content = await fs.promises.readFile(path, {encoding: 'utf8'})
|
||||||
return {path, content}
|
return {path, content}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return files
|
||||||
}
|
}
|
||||||
|
|
||||||
run()
|
run()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue