What are best practices to test a main.kts script?
# scripting
p
What are best practices to test a main.kts script?
m
Half joking but: • no tests?
Some of my scripts, I do put top level functions and for testing I call some of them with predefined arguments
But that's as far as I go. If I need more testing, I create a Gradle build
d
@mbonnin do you mean launching the notebooks as part of the Gradle check task? I am interested in knowing if you have an easy way to set that up.
m
Wait, are we talking of notebooks?
What I meant is if I have a script that is a
*.main.kts
file and I start needing tests, this is probably a sign it needs to be a more serious project
👍 2
➕ 2
d
Lol, sorry... misread the channel name.
👍 1
m
For notebooks yea, I hva no idea how to test
Probably I'd do the same and turn my notebook into a JVM cli tool
But the whole point of notebooks is that it's interactive so not sure I'd want to test much
p
Half joking but:
• no tests?
Somehow devs (me included!) often treat scripts like a second class citizen. We write it in languages we don’t fully understand and don’t test it. But in the end it’s often times driving vital pieces like the release process. For now I’ve just added a --test flag: https://github.com/PaulWoitaschek/Voice/blob/c8ef6b7986134e7e24b184bbda0f5513725701e9/release.main.kts#L17
👍 3