How can I print the complete exception stacktrace ...
# kotest
g
How can I print the complete exception stacktrace of the code under test with Kotest? For example, it gives only the exception's stacktrace of Kotest, but not the code under test
a
can you share a code snippet
g
A sample stacktrace. Sorry has a lot of noise Here is a repo to simulate: LRUCacheTest.kt
Copy code
The following 2 assertions failed:
io.kotest.assertions.MultiAssertionError: The following 2 assertions failed:
1) Test failed for (lruArgs, LRUCacheArgs(classMethodsToCall=[ClassMethodsToCall(arguments=["b", 2], method=insertKeyValuePair), ClassMethodsToCall(arguments=["a", 1], method=insertKeyValuePair), ClassMethodsToCall(arguments=["c", 3], method=insertKeyValuePair), ClassMethodsToCall(arguments=[], method=getMostRecentKey), ClassMethodsToCall(arguments=["a"], method=getValueFromKey), ClassMethodsToCall(arguments=[], method=getMostRecentKey), ClassMethodsToCall(arguments=["d", 4], method=insertKeyValuePair), ClassMethodsToCall(arguments=["b"], method=getValueFromKey), ClassMethodsToCall(arguments=["a", 5], method=insertKeyValuePair), ClassMethodsToCall(arguments=["a"], method=getValueFromKey)], maxSize=3)), (result, ([c, 1, a, null, 5], [(a, 5), (d, 4), (c, 3)])) with error java.util.ConcurrentModificationException
   at java.base/java.util.HashMap.compute(HashMap.java:1326)
2) Test failed for (lruArgs, LRUCacheArgs(classMethodsToCall=[ClassMethodsToCall(arguments=["a", 1], method=insertKeyValuePair), ClassMethodsToCall(arguments=["b", 2], method=insertKeyValuePair), ClassMethodsToCall(arguments=["c", 3], method=insertKeyValuePair), ClassMethodsToCall(arguments=["d", 4], method=insertKeyValuePair), ClassMethodsToCall(arguments=["a"], method=getValueFromKey), ClassMethodsToCall(arguments=["b"], method=getValueFromKey), ClassMethodsToCall(arguments=["c"], method=getValueFromKey), ClassMethodsToCall(arguments=["d"], method=getValueFromKey), ClassMethodsToCall(arguments=["e", 5], method=insertKeyValuePair), ClassMethodsToCall(arguments=["a"], method=getValueFromKey), ClassMethodsToCall(arguments=["b"], method=getValueFromKey), ClassMethodsToCall(arguments=["c"], method=getValueFromKey), ClassMethodsToCall(arguments=["d"], method=getValueFromKey), ClassMethodsToCall(arguments=["e"], method=getValueFromKey)], maxSize=4)), (result, ([1, 2, 3, 4, null, 2, 3, 4, 5], [(e, 5), (d, 4), (c, 3), (b, 2)])) with error java.util.ConcurrentModificationException
   at java.base/java.util.HashMap.compute(HashMap.java:1326)

	at io.kotest.assertions.MultiAssertionErrorBuilder.build(multi.kt:27)
	at io.kotest.data.ErrorCollector.assertAll(errors.kt:21)
	at io.kotest.data.ForAll2Kt.forAll(forAll2.kt:59)
	at algoexpert.ll.lrucache.LRUCacheTest$1$1.invokeSuspend(LRUCacheTest.kt:15)
	at algoexpert.ll.lrucache.LRUCacheTest$1$1.invoke(LRUCacheTest.kt)
	at algoexpert.ll.lrucache.LRUCacheTest$1$1.invoke(LRUCacheTest.kt)
	at io.kotest.core.spec.style.scopes.StringSpecRootScope$invoke$1.invokeSuspend(StringSpecRootScope.kt:71)
	at io.kotest.core.spec.style.scopes.StringSpecRootScope$invoke$1.invoke(StringSpecRootScope.kt)
It indicates this exception, but doesn't indicate where it's coming from in the code under test
java.util.ConcurrentModificationException