Compare commits
52 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
5609ce4db7 | |
|
|
2f39fde5c9 | |
|
|
f93e996901 | |
|
|
d3a4a98751 | |
|
|
e3dc3b8070 | |
|
|
32ab8c7c18 | |
|
|
67f18696e2 | |
|
|
3265345995 | |
|
|
bd9ece3d5b | |
|
|
2cdc4b541f | |
|
|
2fc8e72d6d | |
|
|
1a128e49c0 | |
|
|
6966497014 | |
|
|
6e69e96316 | |
|
|
f7d3eb51ad | |
|
|
7b2af11512 | |
|
|
b8621febee | |
|
|
87fddf2d4c | |
|
|
199051a14a | |
|
|
571e1c7564 | |
|
|
1779a538c8 | |
|
|
6f22747ddf | |
|
|
a16fc5026c | |
|
|
1a4864283d | |
|
|
ce87cc29c8 | |
|
|
a2911bd1a4 | |
|
|
c9aa8e4c61 | |
|
|
4960c6f72d | |
|
|
687f107f48 | |
|
|
a27556b71f | |
|
|
9e99e42245 | |
|
|
b51833dace | |
|
|
21d3eaf2ba | |
|
|
7f7a8752e7 | |
|
|
b733e5fa06 | |
|
|
d949797a56 | |
|
|
2b73eae2a1 | |
|
|
9c98777b5e | |
|
|
cd2404de99 | |
|
|
e882a15498 | |
|
|
09ce9cb18e | |
|
|
8b7ece62e6 | |
|
|
6efd3d10b5 | |
|
|
cb8fa567f8 | |
|
|
aa43217b5c | |
|
|
372a0a3ce6 | |
|
|
e7304b1507 | |
|
|
901f7f3fb7 | |
|
|
78edec6077 | |
|
|
6408e20d8a | |
|
|
3163ccef2b | |
|
|
2c1664c634 |
|
|
@ -1 +0,0 @@
|
||||||
dist/*
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"env": {
|
|
||||||
"commonjs": true,
|
|
||||||
"es6": true,
|
|
||||||
"node": true,
|
|
||||||
"jest": true
|
|
||||||
},
|
|
||||||
"extends": "eslint:recommended",
|
|
||||||
"globals": {
|
|
||||||
"Atomics": "readonly",
|
|
||||||
"SharedArrayBuffer": "readonly"
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2018
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"indent": 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -16,30 +16,31 @@ jobs:
|
||||||
contents: read
|
contents: read
|
||||||
checks: write
|
checks: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
java-version: 8
|
java-version: 8
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: 'maven'
|
cache: 'maven'
|
||||||
- run: cd tests && mvn clean test --batch-mode -Dmaven.test.failure.ignore=true
|
- run: cd integration-tests/maven && mvn clean verify --batch-mode -Dmaven.test.failure.ignore=true
|
||||||
- uses: ./
|
- uses: ./
|
||||||
if: github.ref != 'refs/heads/master'
|
if: github.ref != 'refs/heads/master'
|
||||||
with:
|
with:
|
||||||
check_name: Example Surefire Test Report
|
check_name: Example Surefire Test Report
|
||||||
|
report_paths: '**/surefire-reports/*.xml, **/failsafe-reports/*.xml'
|
||||||
- uses: cclauss/GitHub-Action-for-pytest@0.5.0
|
- uses: cclauss/GitHub-Action-for-pytest@0.5.0
|
||||||
with:
|
with:
|
||||||
args: pytest --junit-xml=python/report.xml python/ || exit 0
|
args: pytest integration-tests/python/ --junit-xml=integration-tests/python/report.xml || exit 0
|
||||||
- uses: ./
|
- uses: ./
|
||||||
if: github.ref != 'refs/heads/master'
|
if: github.ref != 'refs/heads/master'
|
||||||
with:
|
with:
|
||||||
check_name: Example Pytest Report
|
check_name: Example Pytest Report
|
||||||
report_paths: python/report.xml
|
report_paths: integration-tests/python/report.xml
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.21.x
|
||||||
- run: |
|
- run: |
|
||||||
cd go &&
|
cd integration-tests/go &&
|
||||||
go install github.com/jstemmer/go-junit-report/v2@latest &&
|
go install github.com/jstemmer/go-junit-report/v2@latest &&
|
||||||
go test -v 2>&1 ./... |
|
go test -v 2>&1 ./... |
|
||||||
go-junit-report -out report.xml
|
go-junit-report -out report.xml
|
||||||
|
|
@ -47,11 +48,11 @@ jobs:
|
||||||
if: github.ref != 'refs/heads/master'
|
if: github.ref != 'refs/heads/master'
|
||||||
with:
|
with:
|
||||||
check_name: Example Go Report
|
check_name: Example Go Report
|
||||||
report_paths: go/report.xml
|
report_paths: integration-tests/go/report.xml
|
||||||
file_name_in_stack_trace: true
|
file_name_in_stack_trace: true
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 20
|
||||||
cache: npm
|
cache: npm
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm run eslint
|
- run: npm run eslint
|
||||||
|
|
|
||||||
10
README.md
10
README.md
|
|
@ -33,6 +33,10 @@ Optional. Check will fail if there are test failures. The default is `false`.
|
||||||
|
|
||||||
Optional. Check will fail if no tests were found. The default is `true`.
|
Optional. Check will fail if no tests were found. The default is `true`.
|
||||||
|
|
||||||
|
### `ignore_flaky_tests`
|
||||||
|
|
||||||
|
Optional. Set to `true` to consider flaky tests as success. The default is `false`.
|
||||||
|
|
||||||
### `skip_publishing`
|
### `skip_publishing`
|
||||||
|
|
||||||
Optional. Skip the test report publishing (check run creation). The default is `false`.
|
Optional. Skip the test report publishing (check run creation). The default is `false`.
|
||||||
|
|
@ -61,9 +65,13 @@ jobs:
|
||||||
build:
|
build:
|
||||||
name: Build and Run Tests
|
name: Build and Run Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# Permissions block is optional, useful for dependabot checks
|
||||||
|
permissions:
|
||||||
|
checks: write
|
||||||
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v4
|
||||||
- name: Build and Run Tests
|
- name: Build and Run Tests
|
||||||
run: mvn test --batch-mode --fail-at-end
|
run: mvn test --batch-mode --fail-at-end
|
||||||
- name: Publish Test Report
|
- name: Publish Test Report
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,12 @@ const action = async () => {
|
||||||
const commit = core.getInput('commit');
|
const commit = core.getInput('commit');
|
||||||
const failOnFailedTests = core.getInput('fail_on_test_failures') === 'true';
|
const failOnFailedTests = core.getInput('fail_on_test_failures') === 'true';
|
||||||
const failIfNoTests = core.getInput('fail_if_no_tests') === 'true';
|
const failIfNoTests = core.getInput('fail_if_no_tests') === 'true';
|
||||||
|
const ignoreFlakyTests = core.getInput('ignore_flaky_tests') === 'true';
|
||||||
const skipPublishing = core.getInput('skip_publishing') === 'true';
|
const skipPublishing = core.getInput('skip_publishing') === 'true';
|
||||||
const isFilenameInStackTrace = core.getInput('file_name_in_stack_trace') === 'true';
|
const isFilenameInStackTrace = core.getInput('file_name_in_stack_trace') === 'true';
|
||||||
const githubBaseUrl = core.getInput('github_base_url');
|
const githubBaseUrl = core.getInput('github_base_url');
|
||||||
|
|
||||||
let { count, skipped, annotations } = await parseTestReports(reportPaths, isFilenameInStackTrace);
|
let { count, skipped, annotations } = await parseTestReports(reportPaths, isFilenameInStackTrace, ignoreFlakyTests);
|
||||||
const foundResults = count > 0 || skipped > 0;
|
const foundResults = count > 0 || skipped > 0;
|
||||||
const conclusion =
|
const conclusion =
|
||||||
(foundResults && annotations.length === 0) || (!foundResults && !failIfNoTests)
|
(foundResults && annotations.length === 0) || (!foundResults && !failIfNoTests)
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ const finishedWithFailures = {
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
conclusion: 'failure',
|
conclusion: 'failure',
|
||||||
output: {
|
output: {
|
||||||
title: '19 tests run, 1 skipped, 12 failed.',
|
title: '20 tests run, 1 skipped, 13 failed.',
|
||||||
summary: '',
|
summary: '',
|
||||||
annotations: [
|
annotations: [
|
||||||
{
|
{
|
||||||
path:
|
path:
|
||||||
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
||||||
start_line: 39,
|
start_line: 39,
|
||||||
end_line: 39,
|
end_line: 39,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -22,7 +22,7 @@ const finishedWithFailures = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path:
|
path:
|
||||||
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
||||||
start_line: 49,
|
start_line: 49,
|
||||||
end_line: 49,
|
end_line: 49,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -35,7 +35,7 @@ const finishedWithFailures = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path:
|
path:
|
||||||
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
||||||
start_line: 57,
|
start_line: 57,
|
||||||
end_line: 57,
|
end_line: 57,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -48,7 +48,7 @@ const finishedWithFailures = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path:
|
path:
|
||||||
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
||||||
start_line: 18,
|
start_line: 18,
|
||||||
end_line: 18,
|
end_line: 18,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -61,7 +61,7 @@ const finishedWithFailures = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path:
|
path:
|
||||||
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
||||||
start_line: 32,
|
start_line: 32,
|
||||||
end_line: 32,
|
end_line: 32,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -74,7 +74,7 @@ const finishedWithFailures = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path:
|
path:
|
||||||
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
||||||
start_line: 25,
|
start_line: 25,
|
||||||
end_line: 25,
|
end_line: 25,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -88,7 +88,7 @@ const finishedWithFailures = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path:
|
path:
|
||||||
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java',
|
||||||
start_line: 66,
|
start_line: 66,
|
||||||
end_line: 66,
|
end_line: 66,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -101,7 +101,7 @@ const finishedWithFailures = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path:
|
path:
|
||||||
'tests/evil_twins/src/test/java/action/surefire/report/twin/second/TwinTest.java',
|
'integration-tests/maven/evil_twins/src/test/java/action/surefire/report/twin/second/TwinTest.java',
|
||||||
start_line: 13,
|
start_line: 13,
|
||||||
end_line: 13,
|
end_line: 13,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -113,7 +113,18 @@ const finishedWithFailures = {
|
||||||
"java.lang.AssertionError: \n\nExpected: \"Good Twin\"\n but: was \"Evil Twin\"\n\tat action.surefire.report.twin.second.TwinTest.should_always_fail(TwinTest.java:13)"
|
"java.lang.AssertionError: \n\nExpected: \"Good Twin\"\n but: was \"Evil Twin\"\n\tat action.surefire.report.twin.second.TwinTest.should_always_fail(TwinTest.java:13)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'tests/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
|
path: 'integration-tests/maven/flakes/src/test/java/action/surefire/report/calc/AllOkWithFlakesTest.java',
|
||||||
|
start_line: 1,
|
||||||
|
end_line: 1,
|
||||||
|
start_column: 0,
|
||||||
|
end_column: 0,
|
||||||
|
annotation_level: 'failure',
|
||||||
|
title: 'AllOkWithFlakesTest.firstTryFailSecondTrySuccess',
|
||||||
|
message: 'firstTryFailSecondTrySuccess',
|
||||||
|
raw_details: ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
|
||||||
start_line: 27,
|
start_line: 27,
|
||||||
end_line: 27,
|
end_line: 27,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -126,7 +137,7 @@ const finishedWithFailures = {
|
||||||
'java.lang.AssertionError: unexpected exception type thrown; expected:<java.lang.IllegalStateException> but was:<java.lang.IllegalArgumentException>\n\tat action.surefire.report.calc.CalcUtilsTest.test error handling(CalcUtilsTest.kt:27)\nCaused by: java.lang.IllegalArgumentException: Amount must have max 2 non-zero decimal places\n\tat action.surefire.report.calc.CalcUtilsTest.scale(CalcUtilsTest.kt:31)\n\tat action.surefire.report.calc.CalcUtilsTest.access$scale(CalcUtilsTest.kt:9)\n\tat action.surefire.report.calc.CalcUtilsTest.test error handling(CalcUtilsTest.kt:27)'
|
'java.lang.AssertionError: unexpected exception type thrown; expected:<java.lang.IllegalStateException> but was:<java.lang.IllegalArgumentException>\n\tat action.surefire.report.calc.CalcUtilsTest.test error handling(CalcUtilsTest.kt:27)\nCaused by: java.lang.IllegalArgumentException: Amount must have max 2 non-zero decimal places\n\tat action.surefire.report.calc.CalcUtilsTest.scale(CalcUtilsTest.kt:31)\n\tat action.surefire.report.calc.CalcUtilsTest.access$scale(CalcUtilsTest.kt:9)\n\tat action.surefire.report.calc.CalcUtilsTest.test error handling(CalcUtilsTest.kt:27)'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'tests/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
|
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
|
||||||
start_line: 15,
|
start_line: 15,
|
||||||
end_line: 15,
|
end_line: 15,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -138,7 +149,7 @@ const finishedWithFailures = {
|
||||||
'java.lang.AssertionError: \n\nExpected: <100.10>\n but: was <100.11>\n\tat action.surefire.report.calc.CalcUtilsTest.test scale(CalcUtilsTest.kt:15)'
|
'java.lang.AssertionError: \n\nExpected: <100.10>\n but: was <100.11>\n\tat action.surefire.report.calc.CalcUtilsTest.test scale(CalcUtilsTest.kt:15)'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'tests/utils/src/test/java/action/surefire/report/calc/StringUtilsTest.java',
|
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/StringUtilsTest.java',
|
||||||
start_line: 27,
|
start_line: 27,
|
||||||
end_line: 27,
|
end_line: 27,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -151,7 +162,7 @@ const finishedWithFailures = {
|
||||||
'java.lang.AssertionError: \n\nExpected: (an instance of java.lang.IllegalArgumentException and exception with message a string containing "This is unexpected")\n but: exception with message a string containing "This is unexpected" message was "Input=\'\' didn\'t match condition."\nStacktrace was: java.lang.IllegalArgumentException: Input=\'\' didn\'t match condition.\n\tat action.surefire.report.calc.StringUtils.requireNotBlank(StringUtils.java:25)\n\tat action.surefire.report.calc.StringUtils.requireNotBlank(StringUtils.java:18)\n\tat action.surefire.report.calc.StringUtilsTest.require_fail(StringUtilsTest.java:27)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\n\tat org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:258)\n\tat org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)\n\tat org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)\n\tat org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)\n\tat org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)\n\tat org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:413)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)\n\tat org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)\n\tat org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)\n\tat org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)\n\tat org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)'
|
'java.lang.AssertionError: \n\nExpected: (an instance of java.lang.IllegalArgumentException and exception with message a string containing "This is unexpected")\n but: exception with message a string containing "This is unexpected" message was "Input=\'\' didn\'t match condition."\nStacktrace was: java.lang.IllegalArgumentException: Input=\'\' didn\'t match condition.\n\tat action.surefire.report.calc.StringUtils.requireNotBlank(StringUtils.java:25)\n\tat action.surefire.report.calc.StringUtils.requireNotBlank(StringUtils.java:18)\n\tat action.surefire.report.calc.StringUtilsTest.require_fail(StringUtilsTest.java:27)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\n\tat org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:258)\n\tat org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)\n\tat org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)\n\tat org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)\n\tat org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)\n\tat org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:413)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)\n\tat org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)\n\tat org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)\n\tat org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)\n\tat org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'tests/utils/src/test/java/action/surefire/report/calc/StringUtilsTest.java',
|
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/StringUtilsTest.java',
|
||||||
start_line: 20,
|
start_line: 20,
|
||||||
end_line: 20,
|
end_line: 20,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,24 @@ describe('action should work', () => {
|
||||||
expect(failed).toBeNull();
|
expect(failed).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should send all ok if tests were flaky and ignore_flaky_test is true', async () => {
|
||||||
|
inputs.report_paths = '**/surefire-reports/TEST-*AllOkWithFlakesTest.xml';
|
||||||
|
inputs.ignore_flaky_tests = 'true';
|
||||||
|
let request = null;
|
||||||
|
const scope = nock('https://api.github.com')
|
||||||
|
.post('/repos/scacap/action-surefire-report/check-runs', body => {
|
||||||
|
request = body;
|
||||||
|
return body;
|
||||||
|
})
|
||||||
|
.reply(200, {});
|
||||||
|
await action();
|
||||||
|
scope.done();
|
||||||
|
|
||||||
|
expect(request).toStrictEqual(finishedSuccess);
|
||||||
|
expect(outputs).toHaveProperty('conclusion', 'success');
|
||||||
|
expect(failed).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
it('should send failure if no test results were found', async () => {
|
it('should send failure if no test results were found', async () => {
|
||||||
inputs.report_paths = '**/xxx/*.xml';
|
inputs.report_paths = '**/xxx/*.xml';
|
||||||
let request = null;
|
let request = null;
|
||||||
|
|
@ -191,7 +209,7 @@ describe('action should work', () => {
|
||||||
await action();
|
await action();
|
||||||
scope.done();
|
scope.done();
|
||||||
|
|
||||||
expect(failed).toBe('There were 12 failed tests');
|
expect(failed).toBe('There were 13 failed tests');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,10 @@ inputs:
|
||||||
description: 'fail run if there were no test results found'
|
description: 'fail run if there were no test results found'
|
||||||
required: false
|
required: false
|
||||||
default: 'true'
|
default: 'true'
|
||||||
|
ignore_flaky_tests:
|
||||||
|
description: 'consider flaky tests as success'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
skip_publishing:
|
skip_publishing:
|
||||||
description: 'skip test report publishing'
|
description: 'skip test report publishing'
|
||||||
required: false
|
required: false
|
||||||
|
|
@ -49,5 +53,5 @@ outputs:
|
||||||
description: 'the test outcome, either `success` or `failure`'
|
description: 'the test outcome, either `success` or `failure`'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,30 @@
|
||||||
|
const globals = require('globals');
|
||||||
|
const js = require('@eslint/js');
|
||||||
|
const {FlatCompat} = require('@eslint/eslintrc');
|
||||||
|
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
|
allConfig: js.configs.all
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = [{
|
||||||
|
ignores: ['dist/*'],
|
||||||
|
}, ...compat.extends('eslint:recommended'), {
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.commonjs,
|
||||||
|
...globals.node,
|
||||||
|
...globals.jest,
|
||||||
|
Atomics: 'readonly',
|
||||||
|
SharedArrayBuffer: 'readonly',
|
||||||
|
},
|
||||||
|
|
||||||
|
ecmaVersion: 2018,
|
||||||
|
sourceType: 'commonjs',
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
indent: 2,
|
||||||
|
},
|
||||||
|
}];
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>tests</artifactId>
|
||||||
|
<groupId>action.surefire.report</groupId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>flakes</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hamcrest</groupId>
|
||||||
|
<artifactId>hamcrest-all</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<argLine>-Duser.language=en</argLine>
|
||||||
|
<redirectTestOutputToFile>true</redirectTestOutputToFile>
|
||||||
|
<testFailureIgnore>true</testFailureIgnore>
|
||||||
|
<rerunFailingTestsCount>1</rerunFailingTestsCount>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>compile</id>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>testCompile</id>
|
||||||
|
<phase>test-compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>testCompile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package action.surefire.report.calc;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
public class AllOkWithFlakesTest {
|
||||||
|
|
||||||
|
private static boolean failTest = true;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void firstTryFailSecondTrySuccess() {
|
||||||
|
if(failTest) {
|
||||||
|
failTest = false;
|
||||||
|
assertTrue(false);
|
||||||
|
} else {
|
||||||
|
assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
<module>utils</module>
|
<module>utils</module>
|
||||||
<module>email</module>
|
<module>email</module>
|
||||||
<module>evil_twins</module>
|
<module>evil_twins</module>
|
||||||
|
<module>flakes</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
@ -50,7 +51,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.7</version>
|
<version>2.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.assertj</groupId>
|
<groupId>org.assertj</groupId>
|
||||||
|
|
@ -61,7 +62,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.7</version>
|
<version>3.18.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
@ -78,6 +79,19 @@
|
||||||
<testFailureIgnore>true</testFailureIgnore>
|
<testFailureIgnore>true</testFailureIgnore>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<version>2.22.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
|
|
@ -31,20 +31,20 @@
|
||||||
"titleTemplate": "{title}"
|
"titleTemplate": "{title}"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.10.0",
|
"@actions/core": "1.10.1",
|
||||||
"@actions/github": "5.1.1",
|
"@actions/github": "6.0.0",
|
||||||
"@actions/glob": "0.4.0",
|
"@actions/glob": "0.5.0",
|
||||||
"@octokit/rest": "19.0.7",
|
"@octokit/plugin-retry": "6.0.1",
|
||||||
"@octokit/plugin-retry": "4.1.1",
|
"@octokit/rest": "20.0.2",
|
||||||
"xml-js": "1.6.11"
|
"xml-js": "1.6.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@octokit/fixtures": "22.0.6",
|
"@octokit/fixtures": "23.1.1",
|
||||||
"@vercel/ncc": "0.36.1",
|
"@vercel/ncc": "0.38.3",
|
||||||
"enzyme": "3.11.0",
|
"enzyme": "3.11.0",
|
||||||
"eslint": "8.33.0",
|
"eslint": "9.34.0",
|
||||||
"jest": "29.4.2",
|
"jest": "29.7.0",
|
||||||
"jest-junit": "15.0.0",
|
"jest-junit": "16.0.0",
|
||||||
"nock": "13.3.0"
|
"nock": "14.0.0-beta.14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
56
utils.js
56
utils.js
|
|
@ -9,24 +9,25 @@ const resolveFileAndLine = (file, classname, output, isFilenameInOutput) => {
|
||||||
let filenameWithPackage;
|
let filenameWithPackage;
|
||||||
if (isFilenameInOutput) {
|
if (isFilenameInOutput) {
|
||||||
filename = output.split(':')[0].trim();
|
filename = output.split(':')[0].trim();
|
||||||
filenameWithPackage = filename
|
filenameWithPackage = filename;
|
||||||
} else {
|
} else {
|
||||||
filename = file ? file : classname.split('.').slice(-1)[0].split('(')[0];
|
filename = file ? file : classname.split('.').slice(-1)[0].split('(')[0];
|
||||||
filenameWithPackage = classname.replace(/\./g, "/");
|
filenameWithPackage = classname.replace(/\./g, '/');
|
||||||
}
|
}
|
||||||
const matches = output.match(new RegExp(`${filename}.*?:\\d+`, 'g'));
|
const escapedFilename = filename.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
if (!matches) return { filename: filename, filenameWithPackage: filenameWithPackage, line: 1 };
|
const matches = output.match(new RegExp(`${escapedFilename}.*?:\\d+`, 'g'));
|
||||||
|
if (!matches) return {filename: filename, filenameWithPackage: filenameWithPackage, line: 1};
|
||||||
|
|
||||||
const [lastItem] = matches.slice(-1);
|
const [lastItem] = matches.slice(-1);
|
||||||
const [, line] = lastItem.split(':');
|
const [, line] = lastItem.split(':');
|
||||||
core.debug(`Resolved file ${filenameWithPackage} with name ${filename} and line ${line}`);
|
core.debug(`Resolved file ${filenameWithPackage} with name ${filename} and line ${line}`);
|
||||||
|
|
||||||
return { filename, filenameWithPackage, line: parseInt(line) };
|
return {filename, filenameWithPackage, line: parseInt(line)};
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolvePath = async filenameWithPackage => {
|
const resolvePath = async filenameWithPackage => {
|
||||||
core.debug(`Resolving path for ${filenameWithPackage}`);
|
core.debug(`Resolving path for ${filenameWithPackage}`);
|
||||||
const globber = await glob.create([`**/${filenameWithPackage}.*`, `**/${filenameWithPackage}`].join('\n'), { followSymbolicLinks: false });
|
const globber = await glob.create([`**/${filenameWithPackage}.*`, `**/${filenameWithPackage}`].join('\n'), {followSymbolicLinks: false});
|
||||||
const results = await globber.glob();
|
const results = await globber.glob();
|
||||||
core.debug(`Matched files: ${results}`);
|
core.debug(`Matched files: ${results}`);
|
||||||
const searchPath = globber.getSearchPaths()[0];
|
const searchPath = globber.getSearchPaths()[0];
|
||||||
|
|
@ -49,7 +50,20 @@ const resolvePath = async filenameWithPackage => {
|
||||||
return canonicalPath;
|
return canonicalPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
async function parseFile(file, isFilenameInStackTrace) {
|
function getTestsuites(report) {
|
||||||
|
if (report.testsuite) {
|
||||||
|
return [report.testsuite];
|
||||||
|
}
|
||||||
|
if (!report.testsuites || !report.testsuites.testsuite) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (Array.isArray(report.testsuites.testsuite)) {
|
||||||
|
return report.testsuites.testsuite;
|
||||||
|
}
|
||||||
|
return [report.testsuites.testsuite];
|
||||||
|
}
|
||||||
|
|
||||||
|
async function parseFile(file, isFilenameInStackTrace, ignoreFlakyTests) {
|
||||||
core.debug(`Parsing file ${file}`);
|
core.debug(`Parsing file ${file}`);
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let skipped = 0;
|
let skipped = 0;
|
||||||
|
|
@ -57,12 +71,11 @@ async function parseFile(file, isFilenameInStackTrace) {
|
||||||
|
|
||||||
const data = await fs.promises.readFile(file);
|
const data = await fs.promises.readFile(file);
|
||||||
|
|
||||||
const report = JSON.parse(parser.xml2json(data, { compact: true }));
|
const report = JSON.parse(parser.xml2json(data, {compact: true}));
|
||||||
const testsuites = report.testsuite
|
core.debug(`parsed report: ${JSON.stringify(report)}`);
|
||||||
? [report.testsuite]
|
|
||||||
: Array.isArray(report.testsuites.testsuite)
|
const testsuites = getTestsuites(report);
|
||||||
? report.testsuites.testsuite
|
core.debug(`test suites: ${JSON.stringify(testsuites)}`);
|
||||||
: [report.testsuites.testsuite];
|
|
||||||
|
|
||||||
for (const testsuite of testsuites) {
|
for (const testsuite of testsuites) {
|
||||||
const testcases = Array.isArray(testsuite.testcase)
|
const testcases = Array.isArray(testsuite.testcase)
|
||||||
|
|
@ -73,7 +86,7 @@ async function parseFile(file, isFilenameInStackTrace) {
|
||||||
for (const testcase of testcases) {
|
for (const testcase of testcases) {
|
||||||
count++;
|
count++;
|
||||||
if (testcase.skipped) skipped++;
|
if (testcase.skipped) skipped++;
|
||||||
if (testcase.failure || testcase.flakyFailure || testcase.error) {
|
if (testcase.failure || (testcase.flakyFailure && !ignoreFlakyTests) || testcase.error) {
|
||||||
let testcaseData =
|
let testcaseData =
|
||||||
(testcase.failure && testcase.failure._cdata) ||
|
(testcase.failure && testcase.failure._cdata) ||
|
||||||
(testcase.failure && testcase.failure._text) ||
|
(testcase.failure && testcase.failure._text) ||
|
||||||
|
|
@ -95,10 +108,11 @@ async function parseFile(file, isFilenameInStackTrace) {
|
||||||
(testcase.error &&
|
(testcase.error &&
|
||||||
testcase.error._attributes &&
|
testcase.error._attributes &&
|
||||||
testcase.error._attributes.message) ||
|
testcase.error._attributes.message) ||
|
||||||
stackTrace.split('\n').slice(0, 2).join('\n')
|
stackTrace.split('\n').slice(0, 2).join('\n') ||
|
||||||
|
testcase._attributes.name
|
||||||
).trim();
|
).trim();
|
||||||
|
|
||||||
const { filename, filenameWithPackage, line } = resolveFileAndLine(
|
const {filename, filenameWithPackage, line} = resolveFileAndLine(
|
||||||
testcase._attributes.file,
|
testcase._attributes.file,
|
||||||
testcase._attributes.classname,
|
testcase._attributes.classname,
|
||||||
stackTrace,
|
stackTrace,
|
||||||
|
|
@ -123,22 +137,22 @@ async function parseFile(file, isFilenameInStackTrace) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { count, skipped, annotations };
|
return {count, skipped, annotations};
|
||||||
}
|
}
|
||||||
|
|
||||||
const parseTestReports = async (reportPaths, isFilenameInStackTrace) => {
|
const parseTestReports = async (reportPaths, isFilenameInStackTrace, ignoreFlakyTests) => {
|
||||||
const globber = await glob.create(reportPaths, { followSymbolicLinks: false });
|
const globber = await glob.create(reportPaths, {followSymbolicLinks: false});
|
||||||
let annotations = [];
|
let annotations = [];
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let skipped = 0;
|
let skipped = 0;
|
||||||
for await (const file of globber.globGenerator()) {
|
for await (const file of globber.globGenerator()) {
|
||||||
const { count: c, skipped: s, annotations: a } = await parseFile(file, isFilenameInStackTrace);
|
const {count: c, skipped: s, annotations: a} = await parseFile(file, isFilenameInStackTrace, ignoreFlakyTests);
|
||||||
if (c === 0) continue;
|
if (c === 0) continue;
|
||||||
count += c;
|
count += c;
|
||||||
skipped += s;
|
skipped += s;
|
||||||
annotations = annotations.concat(a);
|
annotations = annotations.concat(a);
|
||||||
}
|
}
|
||||||
return { count, skipped, annotations };
|
return {count, skipped, annotations};
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { resolveFileAndLine, resolvePath, parseFile, parseTestReports };
|
module.exports = { resolveFileAndLine, resolvePath, parseFile, parseTestReports };
|
||||||
|
|
|
||||||
|
|
@ -99,32 +99,32 @@ describe('resolvePath', () => {
|
||||||
it('should find correct file for Java filename', async () => {
|
it('should find correct file for Java filename', async () => {
|
||||||
const path = await resolvePath('EmailAddressTest');
|
const path = await resolvePath('EmailAddressTest');
|
||||||
expect(path).toBe(
|
expect(path).toBe(
|
||||||
'tests/email/src/test/java/action/surefire/report/email/EmailAddressTest.java'
|
'integration-tests/maven/email/src/test/java/action/surefire/report/email/EmailAddressTest.java'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should find correct file for Kotlin filename', async () => {
|
it('should find correct file for Kotlin filename', async () => {
|
||||||
const path = await resolvePath('CalcUtilsTest');
|
const path = await resolvePath('CalcUtilsTest');
|
||||||
expect(path).toBe('tests/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt');
|
expect(path).toBe('integration-tests/maven/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should find correct file when extension is included', async () => {
|
it('should find correct file when extension is included', async () => {
|
||||||
const path = await resolvePath('CalcUtilsTest.kt');
|
const path = await resolvePath('CalcUtilsTest.kt');
|
||||||
expect(path).toBe('tests/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt');
|
expect(path).toBe('integration-tests/maven/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('parseFile', () => {
|
describe('parseFile', () => {
|
||||||
it('should parse CalcUtils results', async () => {
|
it('should parse CalcUtils results', async () => {
|
||||||
const { count, skipped, annotations } = await parseFile(
|
const { count, skipped, annotations } = await parseFile(
|
||||||
'tests/utils/target/surefire-reports/TEST-action.surefire.report.calc.CalcUtilsTest.xml'
|
'integration-tests/maven/utils/target/surefire-reports/TEST-action.surefire.report.calc.CalcUtilsTest.xml'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(count).toBe(2);
|
expect(count).toBe(2);
|
||||||
expect(skipped).toBe(0);
|
expect(skipped).toBe(0);
|
||||||
expect(annotations).toStrictEqual([
|
expect(annotations).toStrictEqual([
|
||||||
{
|
{
|
||||||
path: 'tests/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
|
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
|
||||||
start_line: 27,
|
start_line: 27,
|
||||||
end_line: 27,
|
end_line: 27,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -133,11 +133,10 @@ describe('parseFile', () => {
|
||||||
title: 'CalcUtilsTest.test error handling',
|
title: 'CalcUtilsTest.test error handling',
|
||||||
message:
|
message:
|
||||||
'unexpected exception type thrown; expected:<java.lang.IllegalStateException> but was:<java.lang.IllegalArgumentException>',
|
'unexpected exception type thrown; expected:<java.lang.IllegalStateException> but was:<java.lang.IllegalArgumentException>',
|
||||||
raw_details:
|
raw_details: expect.stringContaining('at action.surefire.report.calc.CalcUtilsTest.test error handling(CalcUtilsTest.kt:27)')
|
||||||
'java.lang.AssertionError: unexpected exception type thrown; expected:<java.lang.IllegalStateException> but was:<java.lang.IllegalArgumentException>\n\tat action.surefire.report.calc.CalcUtilsTest.test error handling(CalcUtilsTest.kt:27)\nCaused by: java.lang.IllegalArgumentException: Amount must have max 2 non-zero decimal places\n\tat action.surefire.report.calc.CalcUtilsTest.scale(CalcUtilsTest.kt:31)\n\tat action.surefire.report.calc.CalcUtilsTest.access$scale(CalcUtilsTest.kt:9)\n\tat action.surefire.report.calc.CalcUtilsTest.test error handling(CalcUtilsTest.kt:27)'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'tests/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
|
path: 'integration-tests/maven/utils/src/test/java/action/surefire/report/calc/CalcUtilsTest.kt',
|
||||||
start_line: 15,
|
start_line: 15,
|
||||||
end_line: 15,
|
end_line: 15,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -145,19 +144,18 @@ describe('parseFile', () => {
|
||||||
annotation_level: 'failure',
|
annotation_level: 'failure',
|
||||||
title: 'CalcUtilsTest.test scale',
|
title: 'CalcUtilsTest.test scale',
|
||||||
message: 'Expected: <100.10>\n but: was <100.11>',
|
message: 'Expected: <100.10>\n but: was <100.11>',
|
||||||
raw_details:
|
raw_details: expect.stringContaining('at action.surefire.report.calc.CalcUtilsTest.test scale(CalcUtilsTest.kt:15)')
|
||||||
'java.lang.AssertionError: \n\nExpected: <100.10>\n but: was <100.11>\n\tat action.surefire.report.calc.CalcUtilsTest.test scale(CalcUtilsTest.kt:15)'
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
it('should parse pytest results', async () => {
|
it('should parse pytest results', async () => {
|
||||||
const { count, skipped, annotations } = await parseFile('python/report.xml');
|
const { count, skipped, annotations } = await parseFile('integration-tests/python/report.xml');
|
||||||
|
|
||||||
expect(count).toBe(3);
|
expect(count).toBe(3);
|
||||||
expect(skipped).toBe(0);
|
expect(skipped).toBe(0);
|
||||||
expect(annotations).toStrictEqual([
|
expect(annotations).toStrictEqual([
|
||||||
{
|
{
|
||||||
path: 'python/test_sample.py',
|
path: 'integration-tests/python/test_sample.py',
|
||||||
start_line: 10,
|
start_line: 10,
|
||||||
end_line: 10,
|
end_line: 10,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -166,10 +164,10 @@ describe('parseFile', () => {
|
||||||
title: 'test_sample.test_which_fails',
|
title: 'test_sample.test_which_fails',
|
||||||
message: "AssertionError: assert 'test' == 'xyz'\n - xyz\n + test",
|
message: "AssertionError: assert 'test' == 'xyz'\n - xyz\n + test",
|
||||||
raw_details:
|
raw_details:
|
||||||
"def test_which_fails():\n event = { 'attr': 'test'}\n> assert event['attr'] == 'xyz'\nE AssertionError: assert 'test' == 'xyz'\nE - xyz\nE + test\n\npython/test_sample.py:10: AssertionError"
|
"def test_which_fails():\n event = { 'attr': 'test'}\n> assert event['attr'] == 'xyz'\nE AssertionError: assert 'test' == 'xyz'\nE - xyz\nE + test\n\nintegration-tests/python/test_sample.py:10: AssertionError"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'python/test_sample.py',
|
path: 'integration-tests/python/test_sample.py',
|
||||||
start_line: 14,
|
start_line: 14,
|
||||||
end_line: 14,
|
end_line: 14,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -178,19 +176,19 @@ describe('parseFile', () => {
|
||||||
title: 'test_sample.test_with_error',
|
title: 'test_sample.test_with_error',
|
||||||
message: "AttributeError: 'dict' object has no attribute 'attr'",
|
message: "AttributeError: 'dict' object has no attribute 'attr'",
|
||||||
raw_details:
|
raw_details:
|
||||||
"def test_with_error():\n event = { 'attr': 'test'}\n> assert event.attr == 'test'\nE AttributeError: 'dict' object has no attribute 'attr'\n\npython/test_sample.py:14: AttributeError"
|
"def test_with_error():\n event = { 'attr': 'test'}\n> assert event.attr == 'test'\nE AttributeError: 'dict' object has no attribute 'attr'\n\nintegration-tests/python/test_sample.py:14: AttributeError"
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
it('should parse go results', async () => {
|
it('should parse go results', async () => {
|
||||||
const {count, skipped, annotations} = await parseFile('go/report.xml', true);
|
const {count, skipped, annotations} = await parseFile('integration-tests/go/report.xml', true);
|
||||||
|
|
||||||
expect(count).toBe(3);
|
expect(count).toBe(3);
|
||||||
expect(skipped).toBe(0);
|
expect(skipped).toBe(0);
|
||||||
// noinspection RegExpRepeatedSpace
|
// noinspection RegExpRepeatedSpace
|
||||||
expect(annotations).toStrictEqual([
|
expect(annotations).toStrictEqual([
|
||||||
{
|
{
|
||||||
path: 'go/main_test.go',
|
path: 'integration-tests/go/main_test.go',
|
||||||
start_line: 12,
|
start_line: 12,
|
||||||
end_line: 12,
|
end_line: 12,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -201,7 +199,7 @@ describe('parseFile', () => {
|
||||||
raw_details: 'main_test.go:12: failing test'
|
raw_details: 'main_test.go:12: failing test'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'go/utils/string_test.go',
|
path: 'integration-tests/go/utils/string_test.go',
|
||||||
start_line: 7,
|
start_line: 7,
|
||||||
end_line: 7,
|
end_line: 7,
|
||||||
start_column: 0,
|
start_column: 0,
|
||||||
|
|
@ -210,7 +208,7 @@ describe('parseFile', () => {
|
||||||
title: 'string_test.go.TestFailing',
|
title: 'string_test.go.TestFailing',
|
||||||
message: 'Failed',
|
message: 'Failed',
|
||||||
raw_details: expect.stringMatching(new RegExp(`string_test.go:7:
|
raw_details: expect.stringMatching(new RegExp(`string_test.go:7:
|
||||||
\\s*Error Trace:.*action-surefire-report/go/utils/string_test.go:7
|
\\s*Error Trace:.*action-surefire-report/integration-tests/go/utils/string_test.go:7
|
||||||
\\s*Error: \\s*Not equal:
|
\\s*Error: \\s*Not equal:
|
||||||
\\s*expected: "1"
|
\\s*expected: "1"
|
||||||
\\s*actual : "2"
|
\\s*actual : "2"
|
||||||
|
|
@ -227,7 +225,7 @@ describe('parseFile', () => {
|
||||||
});
|
});
|
||||||
it('should parse custom report with details as an array', async () => {
|
it('should parse custom report with details as an array', async () => {
|
||||||
const { count, skipped, annotations } = await parseFile(
|
const { count, skipped, annotations } = await parseFile(
|
||||||
'custom_reports/TEST-pro.taskana.common.api.ListUtilTest-H2.xml'
|
'integration-tests/custom_reports/TEST-pro.taskana.common.api.ListUtilTest-H2.xml'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(count).toBe(1);
|
expect(count).toBe(1);
|
||||||
|
|
@ -282,7 +280,7 @@ describe('parseFile', () => {
|
||||||
|
|
||||||
it('should parse custom report with flaky failures', async () => {
|
it('should parse custom report with flaky failures', async () => {
|
||||||
const { count, skipped, annotations } = await parseFile(
|
const { count, skipped, annotations } = await parseFile(
|
||||||
'custom_reports/TEST-test.MyIntegrationTestSuite.xml'
|
'integration-tests/custom_reports/TEST-test.MyIntegrationTestSuite.xml'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(count).toBe(5);
|
expect(count).toBe(5);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue