@@ -20,6 +20,38 @@ fn configureBackend(step: *Step.Compile, target: ResolvedTarget) void {
2020 }
2121}
2222
23+ const TestsSummaryStep = struct {
24+ step : Step ,
25+
26+ fn create (b : * std.Build ) * TestsSummaryStep {
27+ const self = b .allocator .create (TestsSummaryStep ) catch @panic ("OOM" );
28+ self .* = .{
29+ .step = Step .init (.{
30+ .id = Step .Id .custom ,
31+ .name = "tests_summary" ,
32+ .owner = b ,
33+ .makeFn = make ,
34+ }),
35+ };
36+ return self ;
37+ }
38+
39+ fn addRun (self : * TestsSummaryStep , run_step : * Step ) void {
40+ self .step .dependOn (run_step );
41+ }
42+
43+ fn make (step : * Step , options : Step.MakeOptions ) ! void {
44+ _ = options ;
45+
46+ var passed : u64 = 0 ;
47+ for (step .dependencies .items ) | dependency | {
48+ passed += @intCast (dependency .test_results .passCount ());
49+ }
50+
51+ std .debug .print ("{d} tests passed.\n " , .{passed });
52+ }
53+ };
54+
2355pub fn build (b : * std.Build ) void {
2456 // build steps
2557 const run_step = b .step ("run" , "Build and run the roc cli" );
@@ -394,6 +426,7 @@ pub fn build(b: *std.Build) void {
394426 }
395427
396428 // Create and add module tests
429+ const tests_summary = TestsSummaryStep .create (b );
397430 const module_tests = roc_modules .createModuleTests (b , target , optimize , zstd , test_filters );
398431 for (module_tests ) | module_test | {
399432 // Add compiled builtins to check module tests
@@ -419,7 +452,7 @@ pub fn build(b: *std.Build) void {
419452 individual_test_step .dependOn (& individual_run .step );
420453
421454 b .default_step .dependOn (& module_test .test_step .step );
422- test_step . dependOn (& module_test .run_step .step );
455+ tests_summary . addRun (& module_test .run_step .step );
423456 }
424457
425458 // Add snapshot tool test
@@ -444,7 +477,7 @@ pub fn build(b: *std.Build) void {
444477 if (run_args .len != 0 ) {
445478 run_snapshot_test .addArgs (run_args );
446479 }
447- test_step . dependOn (& run_snapshot_test .step );
480+ tests_summary . addRun (& run_snapshot_test .step );
448481 }
449482
450483 // Add CLI test
@@ -468,7 +501,7 @@ pub fn build(b: *std.Build) void {
468501 if (run_args .len != 0 ) {
469502 run_cli_test .addArgs (run_args );
470503 }
471- test_step . dependOn (& run_cli_test .step );
504+ tests_summary . addRun (& run_cli_test .step );
472505 }
473506
474507 // Add watch tests
@@ -499,9 +532,11 @@ pub fn build(b: *std.Build) void {
499532 if (run_args .len != 0 ) {
500533 run_watch_test .addArgs (run_args );
501534 }
502- test_step . dependOn (& run_watch_test .step );
535+ tests_summary . addRun (& run_watch_test .step );
503536 }
504537
538+ test_step .dependOn (& tests_summary .step );
539+
505540 b .default_step .dependOn (playground_step );
506541 {
507542 const install = playground_test_install ;
0 commit comments