Basics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of normal and works with any version of Elixir.
Explanation
A test file that opts out of async: true says in its header what stops it.
elixir-code-review, references/test-quality.md:
async:is explicit in every file, andasync: trueis the default everywhere — the database sandbox isolates DB tests. A file isasync: falseonly for a blocker the sandbox can't isolate, named in a header comment:Application.put_env, an app-wide singleton or whole-VM absence assertion, or a process whose start-up reads the database outside the test's sandbox ownership. A new sync file without a stated blocker is a finding.
Sync is not free, and that is why the reason is worth writing down. Every async: true
module runs before the sync ones, and a suite comes to lean on that: an async test may read
config that only sync files mutate. So a file that goes sync without a blocker slows the
suite for nothing, and one that goes async while mutating config breaks readers somewhere
else entirely — the two mistakes are not symmetric, and neither is visible at the file you
are reading.
The check reads the lines between defmodule and the use line and asks only whether a
comment or a @moduledoc is there. Whether the stated blocker is the real one is a review
judgment (and an empirical one — flip the file to async: true and see what fails).
Check-Specific Parameters
There are no specific parameters for this check.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.