ieh3oh

August 1, 2026, 4:14am 1

Basically, what the title says: is it possible to print the name of tests that ran? I’ve been doing some TDD lately…

$ zig build test --watch --summary all --error-style verbose_clear
Build Summary: 3/3 steps succeeded
test success
└─ run test cached
   └─ compile test debug native cached 19ms MaxRSS:41M

watching 79 directories, 0 processes

Success! Tests are green! Ship it!

:collision::collision::collision:

Wait! Huh!?!? The code doesn’t even compile?!?! :sob:

Ugh, I ran into this again: How do I get zig build to Run all the tests? (also same pain as Improving Test Runner API)

So I went over to my root.zig and added the magic lines.

test {
    _ = foo;
}

and now tests actually ran.

$ zig build test --watch --summary all --error-style verbose_clear
Build Summary: 3/3 steps succeeded; 2/2 tests passed                                                                                                                         
test success                                                                                                                                                                 
└─ run test 2 pass (2 total) 5ms MaxRSS:4M                                                                                                                                   
   └─ compile test debug native success 447ms MaxRSS:146M                                                                                                                    
                                                                                                                                                                             
watching 79 directories, 0 processes

I have to carefully read the output and search for 2 pass (2 total). That’s the only indication I get that tests actually ran. I don’t even know which tests ran…

Is there something like go test -v, which prints each and every test that runs? It prints the test name even if the test gets cached and doesn’t actually run.

I haven’t yet figured out when Zig will build/run something and when it’ll try to be smart and skip it. I’m constantly worrying about my code being broken.

pzittlau August 1, 2026, 4:32am 2

Yes you can but the standard test runner doesn’t do this. You can find the test runner in your install location in lib/compiler/test_runner.zig. I can warmly recommend this blog post even if it’s a bit older.