Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show stack trace in annotations? #1278

Open
lihaoyi opened this issue Jan 1, 2025 · 1 comment
Open

How to show stack trace in annotations? #1278

lihaoyi opened this issue Jan 1, 2025 · 1 comment

Comments

@lihaoyi
Copy link

lihaoyi commented Jan 1, 2025

The documentation says

truncate_stack_traces Optional. Truncate stack traces from test output to 2 lines in annotations. Defaults to true.

My current config is

      - name: Publish Test Report
        uses: mikepenz/action-junit-report@v5
        if: always() # always run even if the previous step fails
        with:
          summary: true
          detailed_summary: true
          annotate_only: true
          truncate_stack_traces: false
          report_paths: 'out/**/test-report.xml'

However, when a test fails, the annotations do not seem to contain the stack traces:

Screenshot 2025-01-01 at 2 47 08 PM

Even though the test-report.xml seems to contain it

<?xml version='1.0' encoding='UTF-8'?>
<testsuites tests="1" failures="1" errors="0" skipped="0" time="0.179">
        <testsuite name="mill.eval.EvaluationTestsThreads1" tests="1" failures="1" errors="0" skipped="0" time="0.179" timestamp="2025-01-01T06:52:40">
        <properties>
        
      </properties>
        <testcase classname="mill.eval.EvaluationTestsThreads1" name="evaluateMixed.overrideSuperTask" time="0.179">
          <failure message="boom" type="java.lang.Exception">
          java.lang.Exception: boom
    at mill.eval.EvaluationTests.$anonfun$tests$23(EvaluationTests.scala:231)
    at utest.framework.StackMarker$.dropOutside(StackMarker.scala:13)
    at utest.framework.TestCallTree.run(Model.scala:45)
    at utest.framework.TestCallTree.run(Model.scala:43)
    at utest.framework.TestCallTree.run(Model.scala:43)
    at utest.TestRunner$.$anonfun$runAsync$5(TestRunner.scala:74)
    at utest.framework.Executor.utestWrap(Executor.scala:12)
    at utest.framework.Executor.utestWrap$(Executor.scala:10)
    at utest.TestSuite.utestWrap(TestSuite.scala:12)
    at utest.TestRunner$.$anonfun$runAsync$4(TestRunner.scala:71)
    at utest.framework.StackMarker$.dropOutside(StackMarker.scala:13)
    at utest.TestRunner$.$anonfun$runAsync$2(TestRunner.scala:71)
    at utest.TestRunner$.evaluateFutureTree(TestRunner.scala:171)
    at utest.TestRunner$.$anonfun$evaluateFutureTree$2(TestRunner.scala:174)
    at scala.concurrent.Future$.$anonfun$traverse$1(Future.scala:870)
    at scala.collection.IterableOnceOps.foldLeft(IterableOnce.scala:727)
    at scala.collection.IterableOnceOps.foldLeft$(IterableOnce.scala:721)
    at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1303)
    at scala.concurrent.Future$.traverse(Future.scala:870)
    at utest.TestRunner$.evaluateFutureTree(TestRunner.scala:174)
    at utest.TestRunner$.$anonfun$evaluateFutureTree$2(TestRunner.scala:174)
    at scala.concurrent.Future$.$anonfun$traverse$1(Future.scala:870)
    at scala.collection.IterableOnceOps.foldLeft(IterableOnce.scala:727)
    at scala.collection.IterableOnceOps.foldLeft$(IterableOnce.scala:721)
    at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1303)
    at scala.concurrent.Future$.traverse(Future.scala:870)
    at utest.TestRunner$.evaluateFutureTree(TestRunner.scala:174)
    at utest.TestRunner$.runAsync(TestRunner.scala:99)
    at utest.runner.BaseRunner.runSuite(BaseRunner.scala:197)
    at utest.runner.BaseRunner.$anonfun$makeTask$1(BaseRunner.scala:208)
    at utest.runner.Task.execute(Task.scala:20)
    at mill.testrunner.TestRunnerUtils$.runTasks(TestRunnerUtils.scala:148)
    at mill.testrunner.TestRunnerUtils$.runTestFramework0(TestRunnerUtils.scala:206)
    at mill.testrunner.TestRunnerMain0$.main0(TestRunnerMain0.scala:38)
    at mill.testrunner.TestRunnerMain0.main0(TestRunnerMain0.scala:-1)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:568)
    at mill.testrunner.entrypoint.TestRunnerMain.main(TestRunnerMain.java:42)
        </failure>
        </testcase>
      </testsuite>
      </testsuites>

I assume from the docs that annotations are meant to include stack traces, but I'm not seeing them in the annotations I am receiving. Any idea what might be going wrong?

Alternatively, is there some way I can show the stack traces in the summary, perhaps in <detail></detail> expandable sections?

@mikepenz
Copy link
Owner

mikepenz commented Jan 1, 2025

Good day.

The action uses the message of the failure for the annotation.

More specifically, this is the order:
Screenshot 2025-01-01 at 13 38 05

  • message of the failure
  • message of the error
  • stacktrace
  • name of testcase

In your case the message "boom" is the chosen information.

At this time only the message is being used for the annotation on the file: https://github.com/mikepenz/action-junit-report/blob/main/src/annotator.ts#L50-L56


While it would be great to include the stacktrace in the summary, I fear that this would cause in the summary end up being too long. While I couldn't find a specific length limit for the summary, overall PR comments and similar things appear to have a limit of 65536 characters. Which would certainly become a real problem with stacktraces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants