From 3b2ed1ad62099b493b3998508d6f8ea689b8b17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0nan=C3=A7=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 19 Feb 2026 12:55:44 -0500 Subject: [PATCH] browser: prevent nil pointer panic in newTestBrowser on missing browser Replace Fatalf with Errorf + early return so newTestBrowser always returns a non-nil *testBrowser. Fatalf calls runtime.Goexit which terminates the goroutine without returning, leaving callers in parent scopes with a nil pointer that panics on field access. --- internal/js/modules/k6/browser/tests/test_browser.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/js/modules/k6/browser/tests/test_browser.go b/internal/js/modules/k6/browser/tests/test_browser.go index 125c26441..d4c6d3ab2 100644 --- a/internal/js/modules/k6/browser/tests/test_browser.go +++ b/internal/js/modules/k6/browser/tests/test_browser.go @@ -84,7 +84,8 @@ func newTestBrowser(tb testing.TB, opts ...func(*testBrowser)) *testBrowser { b, pid, err := tbr.browserType.Launch(context.Background(), tbr.vu.Context()) if err != nil { - tb.Fatalf("testBrowser: %v", err) + tb.Errorf("testBrowser: %v", err) + return tbr } tbr.Browser = b tbr.ctx = tbr.browserType.Ctx