Skip to content

Commit

Permalink
Merge pull request #1253 from mikepenz/fix/1251
Browse files Browse the repository at this point in the history
Always limit file resolution by workspace root
  • Loading branch information
mikepenz authored Nov 28, 2024
2 parents a427a90 + 80a45f1 commit 9ffe999
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 39 deletions.
2 changes: 2 additions & 0 deletions __tests__/table.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('buildSummaryTables', () => {
'*',
true,
true,
true,
[],
'{{SUITE_NAME}}/{{TEST_NAME}}',
'/'
Expand Down Expand Up @@ -108,6 +109,7 @@ describe('buildSummaryTables', () => {
'*',
true,
true,
true,
[],
'{{SUITE_NAME}}/{{TEST_NAME}}',
'/'
Expand Down
20 changes: 16 additions & 4 deletions __tests__/testParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@ note: run with `RUST_BACKTRACE=1` environment variable to display

describe('resolvePath', () => {
it('should find correct file for Java fileName', async () => {
const path = await resolvePath('EmailAddressTest', ['/build/', '/__pycache__/'])
const path = await resolvePath('', 'EmailAddressTest', ['/build/', '/__pycache__/'])
expect(path).toBe('test_results/tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java')
})

it('should find correct file for Kotlin fileName', async () => {
const path = await resolvePath('CalcUtilsTest', ['/build/', '/__pycache__/'])
const path = await resolvePath('', 'CalcUtilsTest', ['/build/', '/__pycache__/'])
expect(path).toBe('test_results/tests/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt')
})

it('should find correct file with a relative path', async () => {
const path = await resolvePath('./test_results/CalcUtilsTest.kt', ['/build/', '/__pycache__/'])
const path = await resolvePath('', './test_results/CalcUtilsTest.kt', ['/build/', '/__pycache__/'])
expect(path).toBe('test_results/CalcUtilsTest.kt')
})
})
Expand Down Expand Up @@ -191,6 +191,7 @@ describe('parseFile', () => {
undefined,
undefined,
undefined,
undefined,
'/',
undefined,
undefined,
Expand Down Expand Up @@ -268,6 +269,7 @@ describe('parseFile', () => {
'',
false,
false,
false,
['/build/', '/__pycache__/'],
'{{BREAD_CRUMB}}{{SUITE_NAME}}/{{TEST_NAME}}',
'/',
Expand Down Expand Up @@ -434,6 +436,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
'',
false,
false,
false,
undefined,
'{{BREAD_CRUMB}}{{SUITE_NAME}}/{{TEST_NAME}}'
)
Expand Down Expand Up @@ -504,6 +507,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
'test_results/issues/testDisabled.xml',
'',
true,
true,
false,
undefined,
'{{SUITE_NAME}}/{{TEST_NAME}}'
Expand Down Expand Up @@ -813,6 +817,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
'test_results/mocha/mocha.xml',
'*',
true,
true,
false,
undefined,
'{{SUITE_NAME}}/{{TEST_NAME}}'
Expand Down Expand Up @@ -844,6 +849,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
'test_results/mocha/mocha.xml',
'*',
true,
true,
false,
['/build/', '/__pycache__/'],
'{{TEST_NAME}}'
Expand Down Expand Up @@ -875,6 +881,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
'test_results/mocha/mocha.xml',
'*',
true,
true,
false,
['/build/', '/__pycache__/'],
'{{TEST_NAME}}',
Expand Down Expand Up @@ -984,6 +991,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
'test_results/junit-web-test/expectedRetries.xml',
'',
false,
false,
true,
['/build/', '/__pycache__/']
)
Expand Down Expand Up @@ -1060,7 +1068,8 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
'test_results/junit-web-test/expectedRetries.xml',
'',
true,
true
true,
true,
)
expect(testResult).toBeDefined()
const {totalCount, skippedCount, globalAnnotations} = testResult!!
Expand Down Expand Up @@ -1132,6 +1141,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
'test_results/perl/result.xml',
'',
true,
true,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -1254,6 +1264,7 @@ describe('parseTestReports', () => {
'*',
true,
true,
true,
[],
'{{SUITE_NAME}}/{{TEST_NAME}}',
'/'
Expand Down Expand Up @@ -1290,6 +1301,7 @@ describe('parseTestReports', () => {
'',
false,
false,
false,
[],
'',
'/',
Expand Down
67 changes: 50 additions & 17 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export async function run(): Promise<void> {
retrieve('reportPaths', reportPaths, i, reportsCount),
retrieve('suiteRegex', suiteRegex, i, reportsCount),
includePassed,
annotateNotice,
checkRetries,
excludeSources,
retrieve('checkTitleTemplate', checkTitleTemplate, i, reportsCount),
Expand Down
Loading

0 comments on commit 9ffe999

Please sign in to comment.