# dashbitco/mox

Mocks and explicit contracts in Elixir

Repository: https://github.com/dashbitco/mox
Canonical: https://ross.abutalabs.com/products/dashbitco-mox
Language: Elixir
License Family: other
Last push: 2026-08-25T08:30:43+00:00

## Health v2 (maintenance only)
Score: 77/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 35, longevity 100
- inputs: {"age_days": 3264, "days_push": 8, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1401, forks 78 (observed 2026-08-28T04:04:37.235117+00:00)

## What it is
Mox is an Elixir library for defining concurrent mocks based on explicit behaviours (contracts). It enforces strict mocking principles so tests can run with async: true while stubbing behaviour implementations.

## Use cases
- mock external API calls in Elixir tests
- define mocks based on behaviours instead of ad-hoc modules
- keep Elixir tests concurrent with async: true while mocking
- assert on function inputs using pattern matching instead of expectation rules
- enforce explicit contracts between application components
- swap real implementations with test doubles in test_helper.exs

## When to choose
- you write Elixir applications and want reliable, concurrency-safe mocks
- you prefer behaviour-driven design with explicit contracts between modules
- you need mocks that support parallel test execution
- you want to avoid dynamically generated mock modules in tests

## When to avoid
- you need ad-hoc or per-test dynamic mocking without defining behaviours
- you are not working in the Elixir/Erlang ecosystem
- you prefer expectation-based mocking libraries with complex verification rules

## Facets
- artifact type: library
- maturity: stable
- function: testing, mocking
- domain: testing, developer-tools
- platform: elixir, jvm
- tags: elixir, behaviour-based-mocks, concurrent-tests, explicit-contracts

## Member repositories
- dashbitco/mox (main) score 77

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:37.235117+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:39:02.003476+00:00, confidence not recorded.
  - readme: https://github.com/dashbitco/mox (fetched 2026-08-28T04:04:37.235117+00:00, sha db27a261b19a)
- Data as of 2026-08-30T08:39:29.467469+00:00.
