mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
Added build-directory parameter
Used to override the working directory for when the source was build under a different path
This commit is contained in:
parent
e9fa2f582c
commit
0351b3f450
4 changed files with 17 additions and 3 deletions
|
|
@ -60,6 +60,9 @@ inputs:
|
|||
working-directory:
|
||||
description: Relative path under $GITHUB_WORKSPACE where the repository was checked out
|
||||
required: false
|
||||
build-directory:
|
||||
description: Relative path for the source tree when it was compiled (This can be different that working-directory if, for instance, you build inside a docker container)
|
||||
required: false
|
||||
only-summary:
|
||||
description: |
|
||||
Allows you to generate only the summary.
|
||||
|
|
|
|||
7
dist/index.js
generated
vendored
7
dist/index.js
generated
vendored
|
|
@ -294,6 +294,7 @@ class TestReporter {
|
|||
this.maxAnnotations = parseInt(core.getInput('max-annotations', { required: true }));
|
||||
this.failOnError = core.getInput('fail-on-error', { required: true }) === 'true';
|
||||
this.workDirInput = core.getInput('working-directory', { required: false });
|
||||
this.buildDirInput = core.getInput('build-directory', { required: false });
|
||||
this.onlySummary = core.getInput('only-summary', { required: false }) === 'true';
|
||||
this.token = core.getInput('token', { required: true });
|
||||
this.context = (0, github_utils_1.getCheckRunContext)();
|
||||
|
|
@ -327,7 +328,11 @@ class TestReporter {
|
|||
: new local_file_provider_1.LocalFileProvider(this.name, pattern);
|
||||
const parseErrors = this.maxAnnotations > 0;
|
||||
const trackedFiles = parseErrors ? yield inputProvider.listTrackedFiles() : [];
|
||||
const workDir = this.artifact ? undefined : (0, path_utils_1.normalizeDirPath)(process.cwd(), true);
|
||||
const workDir = this.buildDirInput
|
||||
? (0, path_utils_1.normalizeDirPath)(this.buildDirInput, true)
|
||||
: this.artifact
|
||||
? undefined
|
||||
: (0, path_utils_1.normalizeDirPath)(process.cwd(), true);
|
||||
if (parseErrors)
|
||||
core.info(`Found ${trackedFiles.length} files tracked by GitHub`);
|
||||
const options = {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class TestReporter {
|
|||
readonly maxAnnotations = parseInt(core.getInput('max-annotations', {required: true}))
|
||||
readonly failOnError = core.getInput('fail-on-error', {required: true}) === 'true'
|
||||
readonly workDirInput = core.getInput('working-directory', {required: false})
|
||||
readonly buildDirInput = core.getInput('build-directory', {required: false})
|
||||
readonly onlySummary = core.getInput('only-summary', {required: false}) === 'true'
|
||||
readonly token = core.getInput('token', {required: true})
|
||||
readonly octokit: InstanceType<typeof GitHub>
|
||||
|
|
@ -92,7 +93,11 @@ class TestReporter {
|
|||
|
||||
const parseErrors = this.maxAnnotations > 0
|
||||
const trackedFiles = parseErrors ? await inputProvider.listTrackedFiles() : []
|
||||
const workDir = this.artifact ? undefined : normalizeDirPath(process.cwd(), true)
|
||||
const workDir = this.buildDirInput
|
||||
? normalizeDirPath(this.buildDirInput, true)
|
||||
: this.artifact
|
||||
? undefined
|
||||
: normalizeDirPath(process.cwd(), true)
|
||||
|
||||
if (parseErrors) core.info(`Found ${trackedFiles.length} files tracked by GitHub`)
|
||||
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ export class DotnetTrxParser implements TestParser {
|
|||
return undefined
|
||||
}
|
||||
|
||||
|
||||
const message = test.error.Message[0]
|
||||
const stackTrace = test.error.StackTrace[0]
|
||||
let path
|
||||
|
|
@ -168,11 +169,11 @@ export class DotnetTrxParser implements TestParser {
|
|||
const lines = stackTrace.split(/\r*\n/)
|
||||
const re = / in (.+):line (\d+)$/
|
||||
const {trackedFiles} = this.options
|
||||
|
||||
for (const str of lines) {
|
||||
const match = str.match(re)
|
||||
if (match !== null) {
|
||||
const [_, fileStr, lineStr] = match
|
||||
|
||||
const filePath = normalizeFilePath(fileStr)
|
||||
const workDir = this.getWorkDir(filePath)
|
||||
if (workDir) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue