Fork me on GitHub
#kaocha
<
2020-10-29
>
Charlie Briggs09:10:58

what’s the best way to use deftest/testing with the output capture? I’m writing tests which each produce a lot of output and was wrapping related (but not co-dependent) tests in deftest and then naming each with testing but that results in the output for everything in the deftest block being added to the test output for each failure. It feels like I’m missing something here, should I just use deftest, the downside being worse test names?

Charlie Briggs09:10:30

i.e. I was doing:

(deftest v1-updated-events

  (testing "Something about events..."
  ...
  )

  (testing "Something elseabout events..."
  ...
  )
)
but it seems I need to do:
(deftest something-about-events
  ...
)

(deftest something-else-about-events
  ...
)
to get reasonable output, but then I lose the nested test cases and string names

plexus07:11:55

interesting use case @U7L6VDLTZ, I guess most people don't use the output capturing that deliberately, it's more a "since this code happened to generate some output maybe you should see it when the test fails." We could add an option to have the output buffer reset for each testing context. Would you mind making a ticket on Github just to track this? if you or anyone else in interested in trying to implement this I'd be happy to give some pointers and help you get started.

Charlie Briggs22:11:21

Sure, I've raised this: https://github.com/lambdaisland/kaocha/issues/164, thanks for the response