Assertions

How each unit testing framework lets you assert expected outcomes.

Jest

Ships a built-in, expressive assertion library (expect(value).toBe(...)) with a large set of matchers, no separate assertion package needed.

Vitest

Ships a Jest-compatible built-in expect API, so existing assertion knowledge (and often existing test code) carries over directly.

Mocha

Has no built-in assertions at all — teams typically pair it with Chai (expect/should/assert styles) or Node’s built-in assert module.

pytest

Uses Python’s plain assert statement directly, with pytest rewriting assertion failures to show rich, detailed diffs without requiring special assertion methods.

JUnit

Ships built-in static assertion methods (assertEquals, assertTrue, and so on), commonly supplemented with a fluent assertion library like AssertJ for more readable checks.

RSpec

Ships its own expressive matcher library (expect(value).to eq(...)), designed specifically to read like natural English as part of its BDD philosophy.

Go testing

Has no built-in assertion helpers at all — failures are reported manually via t.Error/t.Fatal, though third-party libraries like Testify are commonly added for richer assertions.

xUnit

Ships built-in static assertion methods (Assert.Equal, Assert.True, and so on) as part of the core framework.

PHPUnit

Ships a large built-in set of assertion methods (assertEquals, assertTrue, and so on) as part of the TestCase base class.

Rust built-in tests

Uses the standard library’s assert!/assert_eq!/assert_ne! macros, with no separate assertion crate required for typical use.