cats-effect icon indicating copy to clipboard operation
cats-effect copied to clipboard

`@implicitNotFound` on `Ticker` says to use `ticked` but it's not part of the testkit

Open kubukoz opened this issue 3 years ago • 4 comments

kubukoz avatar Apr 01 '21 21:04 kubukoz

I think the text of the @implicitNotFound just needs some tweaking.

djspiewak avatar Jul 12 '21 18:07 djspiewak

Hi, I'm interested in knowing/learning more about cats and cats-effects, so I started to look after 'good first issue' tasks.

In this case, If I understand it correctly, you can use testkit outside cats-effect but ticked execution method is defined inside the local cats effect tests subproject (cats.effect.Runners trait), so there is no way to use from an external project

For example with a spec like this

"do the things" in {
    val a = unsafeRun(IO(42))
    a.isSuccess must beTrue
}

could the error message be something like ?

could not find an instance of Ticker; You have to add some implicit Ticker to the current scope.

{{{
implicit val ticker: Ticker = Ticker(TestContext())
}}}

One more question, from my ignorance and lack of knowledge about this subject so excuse me if I'm asking something stupid, I understand that Ticker holds the TestContext for some instances, why not just simply require an implicit TestContext instead this Ticker case class ?

jgoday avatar Nov 07 '21 22:11 jgoday

@jgoday I didn't follow this PR closely, but you may want to take a look at https://github.com/typelevel/cats-effect/pull/2276 which reworked TestContext. I'm actually not sure if this issue is relevant anymore 😅

armanbilge avatar Nov 07 '21 22:11 armanbilge

Thanks @armanbilge, I will try to follow that thread about TestContext then !

jgoday avatar Nov 07 '21 22:11 jgoday