typelevel / typelevel/munit-cats-effect

Add 'strict' Suite

Open
#32 3 comments 0 reactions 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

MUnit allows overriding a TestValue to a value to enforce a test always returns that type. In the example it is used for Future.

Due to the lazy evaluation of IO I think it'd be very useful if I could enforce my test would always return an IO to prevent code from never being run. ScalaTest has recently changed their suites to be AnySpec (can return Any) or AsyncSpec (must return a Future). munit-cats-effect could introduce something similar for returned IO's by overriding MUnit's TestValue.

If added to munits-cats-effect, users should probably still have a choice (just like in ScalaTest) between the two styles. And maybe 'strict' should not be the default? I don't have a strong opinion on what the naming should be.

For implementation some refactoring would probably be needed. TestType is made final in munit.FunSuite so the new suite would have to extend from munit.Suite. Code sharing between the two styles is probably also wanted. I'd be interested in helping out with a PR if this is wanted

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

Start by reading MUnit's TestValue and the existing munit-cats-effect suite implementation. Check how munit.FunSuite and munit.Suite differ, especially around the final TestType, and review the ScalaTest AnySpec and AsyncSpec comparison. Done means a selectable strict IO-returning suite exists alongside the current style, with shared behavior preserved and tests covering both choices.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.