Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Selfie JVM Snapshot Garbage Collection is overly zealous when using multiple test suites in gradle

Aperta
#574 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
java, kotlin

Direzione di ricerca

Inizia con il reproducer collegato e le relative istruzioni nel README, quindi segui la logica di garbage collection degli snapshot JUnit5 di Selfie per suite di test Gradle separate. Riproduci l’esecuzione di integrationTest e verifica che gli snapshot in src/test non vengano eliminati quando questi test sono assenti dal classpath di integrationTest. Il lavoro è completato quando gli snapshot dei test unitari non gestiti rimangono intatti, mentre gli snapshot obsoleti continuano a essere gestiti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug jvm

In a project I was using a separate integrationTest source set with the JVM Test Suite approach recommended by Gradle link to instructions.

When done this way, the integration test sources will be in src/integrationTest instead of src/test. The classes in src/test will not be on the classpath of the integration tests.

When running Selfie with JUnit5, the current garbage collection logic is hardcoded to only look for *.ss files in src/test/ and performs a Class.forName(...)  to see if that test still exists and has tests that match the snapshot. If it doesn't find a match, it deletes the file. 

Since the unit tests are invisible on the integrationTest classpath, though, Class.forName(...) throws a ClassNotFoundException so selfie assumes this is a stale file and deletes. As a consequence, all the unit test snapshots are deleted when running the integrationTest task.

Is there some way to get the correct source root from Junit or something like that to avoid deleting unmanaged files?

A reproducer of the described issue can be found here with instructions in the README https://github.com/aelfric/selfie-bug-report-reproducer

Lingua principale
Kotlin
Stelle
101
Fork
18
Merge medio
6g 11h
PR unite (30g)
5

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di diffplug/selfie

Tutte le issue di diffplug/selfie

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.