typelevel / typelevel/munit-cats-effect

Stack traces do not start in test method

Open
#425 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
159
Forks
40
Avg merge
1d 21h
Merged PRs (30d)
6

Description

//> using dep org.scalameta::munit::1.1.0
//> using dep org.typelevel::munit-cats-effect::2.1.0

import cats.effect.IO
import munit.CatsEffectSuite

object Service {
  def op(): IO[String] = IO.delay(throw new Error("expected"))
}

class ServiceSpec extends CatsEffectSuite {
  test("call directly") {
    Service.op()
  }
}
% scala-cli test ServiceTest.scala
Compiling project (Scala 3.6.4, JVM (17))
Compiled project (Scala 3.6.4, JVM (17))
ServiceSpec:
==> X ServiceSpec.call directly  0.062s java.lang.Error: expected
    at Service$.op$$anonfun$1(ServiceTest.scala:8)
    at delay @ Service$.op(ServiceTest.scala:8)
    at flatMap @ munit.internal.NestingChecks$.checkNestingIO(internal.scala:38)

In practice it's not possible to navigate to failing test from stack trace.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the ServiceTest.scala example using scala-cli test, then inspect the stack trace around munit.internal.NestingChecks$.checkNestingIO. The work is done when a thrown error in Service.op can be navigated from the reported trace to the failing ServiceSpec.call directly test method.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.