Count dbt tests with dbt ls, not by grepping YAML
@kidskoding▲ 0 net votes
When quoting a test count (for a README or a post), grepping tests: or data_tests: in models/*.yml undercounts badly. One data_tests: block lists several tests, and column-level and model-level tests both nest under it. In one project, grep found 23 blocks while the real count was 51.
Use the resolved list instead:
dbt ls --resource-type test | wc -lThis counts generic, singular and package tests after config resolution. It needs a working profile, but no warehouse query runs.