{"id":15140943,"url":"https://github.com/mnemnion/ztap","last_synced_at":"2026-01-16T07:24:39.665Z","repository":{"id":256782333,"uuid":"856099063","full_name":"mnemnion/ztap","owner":"mnemnion","description":"ZTAP: TAP producer for zig build test","archived":false,"fork":false,"pushed_at":"2026-01-13T17:36:44.000Z","size":45,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"trunk","last_synced_at":"2026-01-13T19:24:54.413Z","etag":null,"topics":["tap","testing","zig","zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnemnion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-12T01:42:44.000Z","updated_at":"2026-01-13T17:36:43.000Z","dependencies_parsed_at":"2024-09-13T02:57:28.537Z","dependency_job_id":"a0f2ec8f-aa32-4b13-81cd-7347a37828de","html_url":"https://github.com/mnemnion/ztap","commit_stats":null,"previous_names":["mnemnion/ztap"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/mnemnion/ztap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnemnion%2Fztap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnemnion%2Fztap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnemnion%2Fztap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnemnion%2Fztap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnemnion","download_url":"https://codeload.github.com/mnemnion/ztap/tar.gz/refs/heads/trunk","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnemnion%2Fztap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["tap","testing","zig","zig-package"],"created_at":"2024-09-26T08:42:32.907Z","updated_at":"2026-01-16T07:24:39.641Z","avatar_url":"https://github.com/mnemnion.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZTAP\n\nThe [Test Anything Protocol](https://testanything.org/) is a simple,\nvenerable, and widely-used format for reporting the output of tests.\n\nZTAP is a Zig library for running and reporting tests in the TAP 14\nformat.\n\n## Compatibility\n\nZTAP requires Zig 0.14.\n\n## Use\n\nThis can be used as the main unit testing step, or as a custom step.\nInstructions will assume the latter, but are easily adapted for the\nformer case.\n\nAdd to `build.zig.zon` in the usual fashion:\n\n```sh\nzig fetch --save \"https://github.com/mnemnion/ztap/archive/refs/tags/v0.9.2.tar.gz\"\n```\nYou'll need a test runner.  A default one is included, and looks like this:\n\n```zig\nconst std = @import(\"std\");\nconst builtin = @import(\"builtin\");\nconst ztap = @import(\"ztap\");\n\n// This gives TAP-compatible panic handling\npub const panic = std.debug.FullPanic(ztap.ztap_panic);\n\npub fn main() !void {\n    ztap.ztap_test(builtin);\n    std.process.exit(0);\n}\n```\nWhich you could customize, on the off chance that you need that.\n\nDo be sure to exit with `0`, since the protocol interprets non-zero as\na test failure.\n\nNext, set up your `build.zig`.  We'll assume you want to use the\ndefault test runner, and make this a custom step.\n\n```zig\n    // If you want to filter tests, add this.  It works with the stock\n    // unit test runner as well.\n    const test_filters: []const []const u8 = b.option(\n        []const []const u8,\n        \"test-filter\",\n        \"Skip tests that do not match any of the specified filters\",\n    ) orelse \u0026.{};\n\n    const ztap_dep = b.dependency(\"ztap\", .{\n        .target = b.graph.host, // Runs on host!\n        .optimize = optimize,\n    });\n\n    // ZTAP test runner step.\n    const ztap_unit_tests = b.addTest(.{\n        .name = \"ztap-run\",\n        .root_module = module_to_test,\n        .filters = test_filters,\n        // With the provided test runner:\n        .test_runner = .{ .path = ztap_dep.namedLazyPath(\"runner\"), .mode = .simple},\n        // Or you can use your own:\n        // .test_runner = .{ .path = b.path(\"src/ztap_custom_runner.zig\"), .mode = .simple },\n    });\n    ztap_unit_tests.root_module.addImport(\"ztap\", ztap_dep.module(\"ztap\"));\n\n    // To put the runner in zig-out etc.\n    b.installArtifact(ztap_unit_tests);\n\n    const run_ztap_tests = b.addRunArtifact(ztap_unit_tests);\n\n    // To always run tests, even if nothing changed, add this:\n    // run_ztap_tests.has_side_effects = true;\n\n    // TAP producers write to stdout.\n    //\n    // To suppress stderr chatter, you can uncomment this:\n\n    // _ = run_ztap_tests.captureStdErr();\n\n    // Just call this \"test\" to make ZTAP the main test runner.\n    const ztap_step = b.step(\"ztap\", \"Run tests with ZTAP\");\n    ztap_step.dependOn(\u0026run_ztap_tests.step);\n    // Otherwise you can set up default tests as well, in the\n    // expected manner.  It's nice to have options.\n```\nThat should do the trick.  See the first link for an example of what to\nexpect in the way of output.\n\n## Use Notes\n\nZTAP is simply an output format for Zig's test system, and no changes\nshould be necessary to use it as such.  If `error.SkipZigTest` is\nreturned, ZTAP will issue the `# Skip` directive.  Zig doesn't support\na TODO for tests (not that it should necessarily), but TAP does, so if\n`error.ZTapTodo` is returned, ZTAP will issue `# Todo`.  Zig's test\nrunner will treat the latter as any other error.  In the event that Zig\nadds a TODO error to the test system, ZTAP will support that also.\n\nThe `ztap_panic` function will add a comment to the TAP output naming\nthe test, and issue the `Bail out!` directive which is proper for a\nfatal error.  It then calls the default panic handler, which does the\naccustomed things using `stderr`.\n\n## Roadmap\n\nZTAP does what it needs to.  There is no visible need for additional\nfunctionality, the library is stable and in use.\n\nThe only contemplated change is in the event that Zig does add a TODO\ntype error to the test system.  In that event, ZTAP will support both,\nwith a deprecation notice for `error.ZTapTodo`, and the custom error\nwill be removed in 1.0.\n\nSpeaking of 1.0, an earlier version of the README suggested that ZTAP\nwould declare 1.0 under conditions which have in fact been achieved.\nHowever, changes to the panic handling in Zig 0.14 required ZTAP to\nmake changes to its public interface.  In recognition of this, ZTAP\nwill not declare a 1.0 edition before Zig itself does.\n\nHowever, the only breaking changes I will countenance are those needed\nto keep up with changes in Zig.  Other than that, consider ZTAP to have\nreached release status.\n\n### Why Though?\n\nEverything speaks TAP.  CI speaks TAP, distros speak TAP, your editor\nspeaks TAP.  If you find yourself wanting to integrate with some or all\nof these things, ZTAP will TAP your Zig.\n\nAlso, if you print to `stdout`, ZTAP will not hang your unit tests.  That\ndoesn't make it a good idea, TAP harnesses ignore what they don't grok,\nbut it can't help things, and it can screw them up.  It does mean that\ntests will complete in the event that `stdout` is printed to.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnemnion%2Fztap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnemnion%2Fztap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnemnion%2Fztap/lists"}