{"id":37846629,"url":"https://github.com/fgrosse/zaptest","last_synced_at":"2026-01-18T02:39:09.353Z","repository":{"id":57483547,"uuid":"100682451","full_name":"fgrosse/zaptest","owner":"fgrosse","description":"Test helpers to use a github.com/uber-go/zap logger in unit tests.","archived":false,"fork":false,"pushed_at":"2025-10-19T19:42:01.000Z","size":34,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-17T03:10:11.984Z","etag":null,"topics":["helper","testing","zap"],"latest_commit_sha":null,"homepage":"","language":"Go","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/fgrosse.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":"2017-08-18T06:51:53.000Z","updated_at":"2025-12-05T10:35:17.000Z","dependencies_parsed_at":"2025-10-19T21:23:01.357Z","dependency_job_id":"ba720edb-3d37-45e9-bdff-462ac9dd907e","html_url":"https://github.com/fgrosse/zaptest","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":"0.46153846153846156","last_synced_commit":"798c9e1a64a1b84c88a207a6eff3856700776b12"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/fgrosse/zaptest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fzaptest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fzaptest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fzaptest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fzaptest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fgrosse","download_url":"https://codeload.github.com/fgrosse/zaptest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgrosse%2Fzaptest/sbom","scorecard":{"id":398553,"data":{"date":"2025-08-11","repo":{"name":"github.com/fgrosse/zaptest","commit":"787146a03fee2d184823ec5cc473933ad979df04"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/fgrosse/zaptest/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/fgrosse/zaptest/test.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/10 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'main'","Warn: 'stale review dismissal' is disabled on branch 'main'","Warn: branch 'main' does not require approvers","Warn: codeowners review is not required on branch 'main'","Warn: 'last push approval' is disabled on branch 'main'","Warn: 'up-to-date branches' is disabled on branch 'main'","Info: status check found to merge onto on branch 'main'","Info: PRs are required in order to make changes on branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 15 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T19:36:10.321Z","repository_id":57483547,"created_at":"2025-08-18T19:36:10.321Z","updated_at":"2025-08-18T19:36:10.321Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28526585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["helper","testing","zap"],"created_at":"2026-01-16T16:03:53.638Z","updated_at":"2026-01-18T02:39:09.331Z","avatar_url":"https://github.com/fgrosse.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eZaptest ⚡👩‍🔧\u003c/h1\u003e\n\u003cp align=\"center\"\u003eTest helpers to use a github.com/uber-go/zap logger in unit tests.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n   \u003ca href=\"https://github.com/fgrosse/zaptest/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/tag/fgrosse/zaptest.svg?label=version\u0026color=brightgreen\"\u003e\u003c/a\u003e\n   \u003ca href=\"https://github.com/fgrosse/zaptest/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://github.com/fgrosse/zaptest/actions/workflows/test.yml/badge.svg\"\u003e\u003c/a\u003e\n   \u003ca href=\"https://goreportcard.com/report/github.com/fgrosse/zaptest\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/fgrosse/zaptest\"\u003e\u003c/a\u003e\n   \u003ca href=\"https://pkg.go.dev/github.com/fgrosse/zaptest\"\u003e\u003cimg src=\"https://img.shields.io/badge/godoc-reference-blue.svg?color=blue\"\u003e\u003c/a\u003e\n   \u003ca href=\"https://github.com/fgrosse/zaptest/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-4183c4.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nPackage `zaptest` implements test helpers that facilitate using a `zap.Logger`\nin standard go unit tests.\n\nThis package is useful when running unit tests with components that use the\nhttps://github.com/uber-go/zap logging framework. In unit tests we usually want\nto suppress any logging output as long as the tests are not failing or they are\nstarted in a verbose mode.\n\n## Installation \n\n```sh\n$ go get github.com/fgrosse/zaptest\n```\n\n## Usage with standard unit tests\n\nYou can use `zaptest` in standard unit tests. All log output will be sent via\nthe `testing.T` so it will only be shown if the test fails or if the `-v` flag\nwas set.\n\nNote that you can also use `zaptest` in benchmarks because `testing.B` also\nimplements the necessary logger interface.\n\n```go\nfunc TestLogger(t *testing.T) {\n\tl := zaptest.Logger(t)\n\tl.Debug(\"This is a debug message, debug messages will be logged as well\")\n\tl.Info(\"Logs will not be shown during normal test execution\")\n\tl.Warn(\"You can see all log messages of a successful run by passing the -v flag\")\n\tl.Error(\"Additionally the entire log output for a specific unit test will be visible when a test fails\")\n}\n```\n\n## Usage with ginkgo\n\nPackage `zaptest` is also compatible with the https://github.com/onsi/ginkgo BDD\ntesting framework. As with the standard unit tests, any log output for a\nspecific test will only be printed if that test fails or if the test is running\nin verbose mode. With ginkgo use `ginkgo -v` to enable verbose output (`go test -v`\ndoes not seem to work).\n\n```go\n// TestedType is an example of some type you want to test.\n// Note that the TestedType uses a zap logger.\ntype TestedType struct {\n\tlog *zap.Logger\n}\n\n// DoStuff is an example function of the TestedType which uses a logger.\nfunc (tt *TestedType) DoStuff() error {\n\ttt.log.Debug(\"Doing stuff\")\n\treturn nil\n}\n\n// TestLoggerWriter shows how to use the LoggerWriter function for ginkgo tests.\n// Run `ginkgo -v`to see the output of this test.\nfunc TestLoggerWriter(t *testing.T) {\n\tRegisterFailHandler(Fail)\n\tRunSpecs(t, \"Ginkgo Example Suite\")\n}\n\n// Describe the TestedType using ginkgo/gomega.\nvar _ = Describe(\"TestedType\", func() {\n\tIt(\"should do stuff\", func() {\n\t\ttt := \u0026TestedType{log: zaptest.LoggerWriter(GinkgoWriter)}\n\t\tExpect(tt.DoStuff()).To(Succeed())\n\t})\n})\n```\n\n## Usage as library\n\nYou can also use `zaptest` as library since it does not import the `testing`\npackage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgrosse%2Fzaptest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgrosse%2Fzaptest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgrosse%2Fzaptest/lists"}