Fork me on GitHub
#clj-kondo
<
2023-06-07
>
André Camargo18:06:43

Hello folks! What's the best way to keep a unit test suite of clj-kondo hooks? I'm writing a few hooks and I'd like to unit test them. Are you following some approach to achieve that?

Noah Bogart18:06:53

i use clj-kondo in my CI and rely on failure to inform when my hooks might be incorrect lol

borkdude19:06:48

@U04CAPVN1HS You could use clj-kondo as a JVM library and just test for :findings that it should report when you run! over some example code?

André Camargo19:06:49

Nice @UEENNMX0T! So you call clj-kondo in a shell script iterating over several test scenario input files and expected all them to exit code 0?

André Camargo19:06:28

@U04V15CAJ hmmm to use clj-kondo as a JVM library... very interesting!

borkdude19:06:28

Yes, in the JVM you can also call the hooks-api in the REPL :)

Noah Bogart19:06:23

I don't do anything extra, I just write what looks like a valid hook and then try it out a bunch and then rely on normal clj-kondo --parallel --lint dev src test to tell me when i've made a mistake (either in code or in the hook).

André Camargo19:06:35

oh, got it 😉

André Camargo19:06:43

thanks @UEENNMX0T and @U04V15CAJ! insightful tips!

👍 4