munit icon indicating copy to clipboard operation
munit copied to clipboard

Add `contextSize` test parameter to enlarge the scope of a diff

Open TonioGela opened this issue 1 year ago • 6 comments

As per description, this PR introduces a contextSize overridable suite parameter that control the number of lines around the reported diff in case of a mismatch ( ala grep -A <n> -B <n>)

Ofc the normal behaviour was kept identical to the actual, and there's no change in the user API (at least for the methods used via Assertions)

TonioGela avatar May 27 '24 20:05 TonioGela

Hmm, given that a lot of the stuff in Diff is effectively exposed the mima check screams with 11 compatibility errors. I'll try to figure out a better encoding for the content of this PR, so don't take it too seriously for the moment 😇

TonioGela avatar May 27 '24 20:05 TonioGela

Shouldn't this be a parameter to the runner https://github.com/scalameta/munit/blob/8b63f0e7f8574cd7910816d171d98bbf2507d672/munit/js-native/src/main/scala/munit/internal/junitinterface/JUnitFramework.scala#L110 ?

tgodzik avatar May 28 '24 06:05 tgodzik

Shouldn't this be a parameter to the runner

https://github.com/scalameta/munit/blob/8b63f0e7f8574cd7910816d171d98bbf2507d672/munit/js-native/src/main/scala/munit/internal/junitinterface/JUnitFramework.scala#L110 ?

Interesting question. Going further: should it just be a parameter or also a parameter?

TonioGela avatar May 28 '24 07:05 TonioGela

I think just a parameter since it doesn't really change the test logic, but how the test is being displayed. Potentially we could have runner defaults for a specific suite as a separate thing.

tgodzik avatar May 28 '24 07:05 tgodzik

btw. MiMa is not a huge issue here, we would need to do 1.1.x next so that it's automatically picked up as possible incompatibility

tgodzik avatar May 28 '24 07:05 tgodzik

I think just a parameter since it doesn't really change the test logic, but how the test is being displayed. Potentially we could have runner defaults for a specific suite as a separate thing.

Okay, this seems reasonable. I'll try to rework it. I'll also try to add documentation about that flag maybe here: https://scalameta.org/munit/docs/troubleshooting.html

TonioGela avatar May 29 '24 07:05 TonioGela

@TonioGela please take a look at #883 and see if there's anything else left here.

kitbellew avatar Jan 20 '25 20:01 kitbellew