当我们运行Jetpack Compose函数的Jacoco代码覆盖时,我喜欢排除所有预览函数。
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION)
internal annotation class ExcludeFromJacocoGeneratedReport
然后,对于我想从报告中排除的函数,我用以下方式注释它
@ExcludeFromJacocoGeneratedReport
@Preview(
name = "Name"
@Composable
private fun MyComposePreview() {
// ... function content