diffplug / diffplug/selfie

[jvm] better error message when a test exists in a transparent package

Offen
#527 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Kotlin
Sterne
101
Forks
18
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

`selfie.*` is transparent, so if a test is there, it fails like this:

```
org.opentest4j.AssertionFailedError: Couldn't find source file for CallLocation(clazz=org.junit.runners.model.FrameworkMethod$1, method=, fileName=FrameworkMethod.java, line=-1), looked in TypedPath(absolutePath=/home/runner/work/diffplugdotcom/diffplugdotcom/server/src/test/java/) and [/home/runner/work/diffplugdotcom/diffplugdotcom/server/src/test/resources], maybe there are other source roots?
at app//com.diffplug.selfie.junit5.FSJava.assertFailed(SnapshotSystemJUnit5.kt:57)
at app//com.diffplug.selfie.junit5.FSJava.assertFailed(SnapshotSystemJUnit5.kt:43)
at app//com.diffplug.selfie.guts.FS.assertFailed$default(SnapshotSystem.kt:96)
at app//com.diffplug.selfie.junit5.SnapshotFileLayoutJUnit5.sourcePathForCall(SnapshotFileLayoutJUnit5.kt:44)
at app//com.diffplug.selfie.guts.CommentTracker.hasWritableComment(CommentTracker.kt:36)
at app//com.diffplug.selfie.junit5.SnapshotSystemJUnit5.sourceFileHasWritableComment(SnapshotSystemJUnit5.kt:90)
at app//com.diffplug.selfie.Mode.canWrite$selfie_lib(Mode.kt:32)
at app//com.diffplug.selfie.SelfieImplementationsKt.checkSrc(SelfieImplementations.kt:285)
at app//com.diffplug.selfie.SelfieImplementationsKt.access$checkSrc(SelfieImplementations.kt:1)
at app//com.diffplug.selfie.StringSelfie.toBe(SelfieImplementations.kt:206)
at app//selfie.ParsedFormsTest.toMd(ParsedFormsTest.kt:16)
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduziere den Fehler aus ParsedFormsTest.kt und verfolge die Quelltextsuche durch SnapshotFileLayoutJUnit5.kt und SnapshotSystemJUnit5.kt. Bestimme, wie transparente Pakete behandelt werden, sorge dann dafür, dass der Fehler die fehlende Quelle klarer erklärt, und überprüfe die resultierende Meldung mit dem betroffenen Test.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
kotlin
Bereich
testing
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.