Back to Opa

file-missing-test-suffix

docs/projects/regal/rules/testing/file-missing-test-suffix.md

1.16.1897 B
Original Source

file-missing-test-suffix

Summary: Files containing tests should have a _test.rego suffix

Category: Testing

Rationale

In order to clearly communicate intent, and to avoid bundling tests with production policy, tests should be kept in a separate file with a _test.rego suffix, and ideally prefixed with the same name as the policy the tests are targeting, e.g. policy.rego and policy_test.rego.

Configuration Options

This linter rule provides the following configuration options:

yaml
rules:
  testing:
    file-missing-test-suffix:
      # one of "error", "warning", "ignore"
      level: error