mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Merge pull request #128 from dorny/issue-127-fix-pattern-with-backslash
Add option to convert backslashes in path pattern to forward slashes
This commit is contained in:
commit
a585725c8b
6 changed files with 43 additions and 22 deletions
|
|
@ -119,6 +119,11 @@ jobs:
|
||||||
# All matched result files must be of the same format
|
# All matched result files must be of the same format
|
||||||
path: ''
|
path: ''
|
||||||
|
|
||||||
|
# The fast-glob library that is internally used interprets backslashes as escape characters.
|
||||||
|
# If enabled, all backslashes in provided path will be replaced to forward slashes and act as directory separators.
|
||||||
|
# It might be useful when path input variable is composed dynamically from existing directory paths on Windows.
|
||||||
|
path-replace-backslashes: 'false'
|
||||||
|
|
||||||
# Format of test results. Supported options:
|
# Format of test results. Supported options:
|
||||||
# dart-json
|
# dart-json
|
||||||
# dotnet-trx
|
# dotnet-trx
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,13 @@ inputs:
|
||||||
Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
|
Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
|
||||||
All matched result files must be of same format
|
All matched result files must be of same format
|
||||||
required: true
|
required: true
|
||||||
|
path-replace-backslashes:
|
||||||
|
description: |
|
||||||
|
The fast-glob library that is internally used interprets backslashes as escape characters.
|
||||||
|
If enabled, all backslashes in provided path will be replaced by forward slashes and act as directory separators.
|
||||||
|
It might be useful when path input variable is composed dynamically from existing directory paths on Windows.
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
reporter:
|
reporter:
|
||||||
description: |
|
description: |
|
||||||
Format of test results. Supported options:
|
Format of test results. Supported options:
|
||||||
|
|
|
||||||
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
|
|
@ -239,6 +239,7 @@ class TestReporter {
|
||||||
this.artifact = core.getInput('artifact', { required: false });
|
this.artifact = core.getInput('artifact', { required: false });
|
||||||
this.name = core.getInput('name', { required: true });
|
this.name = core.getInput('name', { required: true });
|
||||||
this.path = core.getInput('path', { required: true });
|
this.path = core.getInput('path', { required: true });
|
||||||
|
this.pathReplaceBackslashes = core.getInput('path-replace-backslashes', { required: false }) === 'true';
|
||||||
this.reporter = core.getInput('reporter', { required: true });
|
this.reporter = core.getInput('reporter', { required: true });
|
||||||
this.listSuites = core.getInput('list-suites', { required: true });
|
this.listSuites = core.getInput('list-suites', { required: true });
|
||||||
this.listTests = core.getInput('list-tests', { required: true });
|
this.listTests = core.getInput('list-tests', { required: true });
|
||||||
|
|
@ -268,7 +269,10 @@ class TestReporter {
|
||||||
process.chdir(this.workDirInput);
|
process.chdir(this.workDirInput);
|
||||||
}
|
}
|
||||||
core.info(`Check runs will be created with SHA=${this.context.sha}`);
|
core.info(`Check runs will be created with SHA=${this.context.sha}`);
|
||||||
const pattern = this.path.split(',');
|
// Split path pattern by ',' and optionally convert all backslashes to forward slashes
|
||||||
|
// fast-glob (micromatch) always interprets backslashes as escape characters instead of directory separators
|
||||||
|
const pathsList = this.path.split(',');
|
||||||
|
const pattern = this.pathReplaceBackslashes ? pathsList.map(path_utils_1.normalizeFilePath) : pathsList;
|
||||||
const inputProvider = this.artifact
|
const inputProvider = this.artifact
|
||||||
? new artifact_provider_1.ArtifactProvider(this.octokit, this.artifact, this.name, pattern, this.context.sha, this.context.runId, this.token)
|
? new artifact_provider_1.ArtifactProvider(this.octokit, this.artifact, this.name, pattern, this.context.sha, this.context.runId, this.token)
|
||||||
: new local_file_provider_1.LocalFileProvider(this.name, pattern);
|
: new local_file_provider_1.LocalFileProvider(this.name, pattern);
|
||||||
|
|
|
||||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
36
dist/licenses.txt
generated
vendored
36
dist/licenses.txt
generated
vendored
|
|
@ -341,27 +341,27 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||||
|
|
||||||
adm-zip
|
adm-zip
|
||||||
MIT
|
MIT
|
||||||
Copyright (c) 2012 Another-D-Mention Software and other contributors,
|
MIT License
|
||||||
http://www.another-d-mention.ro/
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Copyright (c) 2012 Another-D-Mention Software and other contributors
|
||||||
a copy of this software and associated documentation files (the
|
|
||||||
"Software"), to deal in the Software without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
included in all copies or substantial portions of the Software.
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
The above copyright notice and this permission notice shall be included in all
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
copies or substantial portions of the Software.
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
before-after-hook
|
before-after-hook
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {JavaJunitParser} from './parsers/java-junit/java-junit-parser'
|
||||||
import {JestJunitParser} from './parsers/jest-junit/jest-junit-parser'
|
import {JestJunitParser} from './parsers/jest-junit/jest-junit-parser'
|
||||||
import {MochaJsonParser} from './parsers/mocha-json/mocha-json-parser'
|
import {MochaJsonParser} from './parsers/mocha-json/mocha-json-parser'
|
||||||
|
|
||||||
import {normalizeDirPath} from './utils/path-utils'
|
import {normalizeDirPath, normalizeFilePath} from './utils/path-utils'
|
||||||
import {getCheckRunContext} from './utils/github-utils'
|
import {getCheckRunContext} from './utils/github-utils'
|
||||||
import {Icon} from './utils/markdown-utils'
|
import {Icon} from './utils/markdown-utils'
|
||||||
|
|
||||||
|
|
@ -33,6 +33,7 @@ class TestReporter {
|
||||||
readonly artifact = core.getInput('artifact', {required: false})
|
readonly artifact = core.getInput('artifact', {required: false})
|
||||||
readonly name = core.getInput('name', {required: true})
|
readonly name = core.getInput('name', {required: true})
|
||||||
readonly path = core.getInput('path', {required: true})
|
readonly path = core.getInput('path', {required: true})
|
||||||
|
readonly pathReplaceBackslashes = core.getInput('path-replace-backslashes', {required: false}) === 'true'
|
||||||
readonly reporter = core.getInput('reporter', {required: true})
|
readonly reporter = core.getInput('reporter', {required: true})
|
||||||
readonly listSuites = core.getInput('list-suites', {required: true}) as 'all' | 'failed'
|
readonly listSuites = core.getInput('list-suites', {required: true}) as 'all' | 'failed'
|
||||||
readonly listTests = core.getInput('list-tests', {required: true}) as 'all' | 'failed' | 'none'
|
readonly listTests = core.getInput('list-tests', {required: true}) as 'all' | 'failed' | 'none'
|
||||||
|
|
@ -71,7 +72,11 @@ class TestReporter {
|
||||||
|
|
||||||
core.info(`Check runs will be created with SHA=${this.context.sha}`)
|
core.info(`Check runs will be created with SHA=${this.context.sha}`)
|
||||||
|
|
||||||
const pattern = this.path.split(',')
|
// Split path pattern by ',' and optionally convert all backslashes to forward slashes
|
||||||
|
// fast-glob (micromatch) always interprets backslashes as escape characters instead of directory separators
|
||||||
|
const pathsList = this.path.split(',')
|
||||||
|
const pattern = this.pathReplaceBackslashes ? pathsList.map(normalizeFilePath) : pathsList
|
||||||
|
|
||||||
const inputProvider = this.artifact
|
const inputProvider = this.artifact
|
||||||
? new ArtifactProvider(
|
? new ArtifactProvider(
|
||||||
this.octokit,
|
this.octokit,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue