Tiny, zero-dependency assertion library for Go tests.
  • Go 95.1%
  • Just 4.9%
Attila Dudas d25bdb37a7
All checks were successful
ci/woodpecker/push/CI Pipeline was successful
Use t.Fatalf() by default
2026-05-15 15:03:08 +02:00
.woodpecker Add CI (#1) 2026-05-14 17:32:22 +02:00
.gitignore Initial commit 2026-05-14 17:27:11 +02:00
assert.go Use t.Fatalf() by default 2026-05-15 15:03:08 +02:00
assert_test.go Fix nil detection in Nil and NotNil 2026-05-15 10:52:16 +02:00
CHANGELOG.md Use t.Fatalf() by default 2026-05-15 15:03:08 +02:00
go.mod Initial commit 2026-05-14 17:27:11 +02:00
go.sum Initial commit 2026-05-14 17:27:11 +02:00
Justfile Add CI (#1) 2026-05-14 17:32:22 +02:00
LICENSE Initial commit 2026-05-14 17:27:11 +02:00
README.md Add go report card 2026-05-14 17:37:30 +02:00

Go Report Card

assert

assert is a tiny, zero-dependency assertion library for Go tests.

The project focuses on a single goal: provide the most useful test assertions with no framework bloat and no external dependency tree. If you like the convenience of assertion helpers but want to avoid alternatives like testify/assert, this library is designed for you.

It keeps the API intentionally small and practical, with helpers such as:

  • boolean assertions
  • error matching (ErrorIs)
  • nil / not-nil checks
  • panic assertions
  • timeout-based test guards

In short: a lean assertion toolkit that stays close to the standard testing package and gets out of your way.

One package, both assert and require semantics

Unlike ecosystems where you import separate packages for assert and require, this library uses one API and lets you configure failure behavior via New(failFunc ...).

  • Use a non-fatal fail function (for example t.Errorf) when you want assert-like behavior.
  • Use a fatal fail function (for example t.FailNow) when you want require-like behavior.
requireLike := assert.New()

assertLike := assert.New(func(t *testing.T, format string, params ...any) {
	t.Helper()
	t.Errorf(format, params...)
})

This gives you the same practical flexibility while keeping dependencies and API surface minimal.