diff --git a/cmd/oras/internal/display/status/text_test.go b/cmd/oras/internal/display/status/text_test.go
index d02121208..6a1d7c75d 100644
--- a/cmd/oras/internal/display/status/text_test.go
+++ b/cmd/oras/internal/display/status/text_test.go
@@ -40,7 +40,7 @@ func TestMain(m *testing.M) {
 	builder = &strings.Builder{}
 	printer = output.NewPrinter(builder, os.Stderr, false)
 	bogus = ocispec.Descriptor{MediaType: ocispec.MediaTypeImageManifest}
-	m.Run()
+	os.Exit(m.Run())
 }
 
 func validatePrinted(t *testing.T, expected string) {
diff --git a/cmd/oras/internal/option/remote_test.go b/cmd/oras/internal/option/remote_test.go
index 2d0f36ed8..2f889bdff 100644
--- a/cmd/oras/internal/option/remote_test.go
+++ b/cmd/oras/internal/option/remote_test.go
@@ -117,7 +117,7 @@ func TestMain(m *testing.M) {
 	ts.TLS = loadTestingTLSConfig()
 	ts.StartTLS()
 	defer ts.Close()
-	m.Run()
+	os.Exit(m.Run())
 }
 
 func TestRemote_FlagsInit(t *testing.T) {
diff --git a/cmd/oras/internal/output/print_test.go b/cmd/oras/internal/output/print_test.go
index 9a1d8c586..24ff6eb85 100644
--- a/cmd/oras/internal/output/print_test.go
+++ b/cmd/oras/internal/output/print_test.go
@@ -34,7 +34,7 @@ func (mw *mockWriter) Write(p []byte) (n int, err error) {
 		return len(string(p)), nil
 	}
 	mw.errorCount++
-	return 0, fmt.Errorf("Boom: " + string(p))
+	return 0, fmt.Errorf("boom %s", string(p))
 }
 
 func (mw *mockWriter) String() string {