fix: silent default test output; verbose controlled by SOURCETEST_VERBOSE env var

go test -json implicitly sets testing.Verbose()=true, so the old guard
always printed manga lists through the script. Switched to an env var
(SOURCETEST_VERBOSE=1) set by the script only when -v is passed.
This commit is contained in:
achmad
2026-05-14 21:02:45 +07:00
parent c2f8c1f0f1
commit 1382c2efd5
2 changed files with 8 additions and 3 deletions
+5 -2
View File
@@ -3,11 +3,14 @@
package sourcetest
import (
"os"
"testing"
"goyomi/internal/source"
)
var verboseOutput = os.Getenv("SOURCETEST_VERBOSE") == "1"
// Run verifies source metadata and, unless -short is set, calls GetPopularManga
// and GetLatestUpdates (when supported) against the live site.
func Run(t *testing.T, s source.CatalogueSource, wantName, wantLang string) {
@@ -39,7 +42,7 @@ func Run(t *testing.T, s source.CatalogueSource, wantName, wantLang string) {
if len(page.Mangas) == 0 {
t.Fatal("GetPopularManga returned 0 results")
}
if testing.Verbose() {
if verboseOutput {
t.Logf("--- GetPopularManga (%d results) ---", len(page.Mangas))
for i, m := range page.Mangas {
t.Logf(" [%d] %-60s %s", i, m.Title, m.URL)
@@ -67,7 +70,7 @@ func Run(t *testing.T, s source.CatalogueSource, wantName, wantLang string) {
if len(page.Mangas) == 0 {
t.Fatal("GetLatestUpdates returned 0 results")
}
if testing.Verbose() {
if verboseOutput {
t.Logf("--- GetLatestUpdates (%d results) ---", len(page.Mangas))
for i, m := range page.Mangas {
t.Logf(" [%d] %-60s %s", i, m.Title, m.URL)