-
Notifications
You must be signed in to change notification settings - Fork 649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: add logging to test context #2443
WIP: add logging to test context #2443
Conversation
...rc/commonMain/kotlin/io/kotest/engine/test/extensions/CoroutineLoggingTestExecutionFilter.kt
Outdated
Show resolved
Hide resolved
kotest-framework/kotest-framework-api/src/commonMain/kotlin/io/kotest/core/config/LogLevel.kt
Outdated
Show resolved
Hide resolved
...kotest-framework-api/src/commonMain/kotlin/io/kotest/core/internal/KotestEngineProperties.kt
Outdated
Show resolved
Hide resolved
...work/kotest-framework-engine/src/commonMain/kotlin/io/kotest/engine/test/TestCaseExecutor.kt
Outdated
Show resolved
Hide resolved
...rc/commonMain/kotlin/io/kotest/engine/test/extensions/CoroutineLoggingTestExecutionFilter.kt
Outdated
Show resolved
Hide resolved
...rc/commonMain/kotlin/io/kotest/engine/test/extensions/CoroutineLoggingTestExecutionFilter.kt
Outdated
Show resolved
Hide resolved
...rc/commonMain/kotlin/io/kotest/engine/test/extensions/CoroutineLoggingTestExecutionFilter.kt
Outdated
Show resolved
Hide resolved
...rc/commonMain/kotlin/io/kotest/engine/test/extensions/CoroutineLoggingTestExecutionFilter.kt
Outdated
Show resolved
Hide resolved
ce63b1f
to
ea14c7d
Compare
298c9d2
to
18e5b95
Compare
18e5b95
to
a880e2e
Compare
val logs = mutableListOf<LogEntry>() | ||
val contextWithLogging = context.withCoroutineContext(TestContextLoggingCoroutineContextElement(logs)) | ||
try { | ||
test(testCase, contextWithLogging) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to wrap test(testCase, contextWithLogging) with a withContext call, because otherwise, downstream interceptors can change it without realizing.
I will fix this up.
} | ||
} | ||
|
||
typealias LogFn = suspend () -> Any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove suspend on logging
Fixes #1992