https://kotlinlang.org logo
#kotest
Title
# kotest
g

Guillaume Saint-Etienne

07/26/2021, 8:59 AM
Hi. Anyone using PiTest with Kotest ? I face some weird behaviours :(
l

LeoColman

07/27/2021, 11:34 AM
I do. What issues are you facing?
g

Guillaume Saint-Etienne

07/28/2021, 7:56 AM
On some kt files, when a mutant is not killed, sometimes the report is failing, because it looks for a line in the kt code source that exceeds the size of the source...
the error is:
Copy code
[2021-07-26T08:47:13.495Z] [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project hermes: 89 is not a valid line for pointer. File distribution/distribution-core/src/main/kotlin/primobox/demat/hermes/distribution/core/domain/aggregates/Sacoche.kt has 84 line(s) -> [Help 1]
[2021-07-26T08:47:13.495Z] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project hermes: 89 is not a valid line for pointer. File distribution/distribution-core/src/main/kotlin/primobox/demat/hermes/distribution/core/domain/aggregates/Sacoche.kt has 84 line(s)
[2021-07-26T08:47:13.495Z]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
C
Copy code
aused by: java.lang.IllegalArgumentException: 89 is not a valid line for pointer. File distribution/distribution-core/src/main/kotlin/primobox/demat/hermes/distribution/core/domain/aggregates/Sacoche.kt has 84 line(s)
[2021-07-26T08:47:13.496Z]     at org.sonar.api.utils.Preconditions.checkArgument (Preconditions.java:43)
[2021-07-26T08:47:13.496Z]     at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid (DefaultInputFile.java:336)
[2021-07-26T08:47:13.496Z]     at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer (DefaultInputFile.java:272)
[2021-07-26T08:47:13.496Z]     at org.sonar.api.batch.fs.internal.DefaultInputFile.selectLine (DefaultInputFile.java:295)
[2021-07-26T08:47:13.496Z]     at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.applyMutantRule (RulesProcessor.java:205)
[2021-07-26T08:47:13.496Z]     at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.applyRule (RulesProcessor.java:117)
[2021-07-26T08:47:13.496Z]     at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.applyRules (RulesProcessor.java:99)
[2021-07-26T08:47:13.496Z]     at ch.devcon5.sonar.plugins.mutationanalysis.sensors.RulesProcessor.lambda$processRules$3 (RulesProcessor.java:83)
It already happened twice in my project the 1st time, it disapeared by chance (I don't know exactly why) this time, i try to change my test, to change the code... nothing works. the only workaround I jound is to exclude that class from being mutated 😞
we use a lot of functionnal style in our code, we use the monal Result a lot and the tests are writen with the BehaviorSpec style; most of the fime
👀 1
l

LeoColman

07/28/2021, 3:39 PM
Do you use inline functions often?
g

Guillaume Saint-Etienne

08/05/2021, 9:20 PM
no, no inline used. However we use a lot of Result monad and fold operations
6 Views