visualci.yml
visualci.yml at the root of your repository holds the project's settings in code. visualci build create finds it, checks it and sends it with the build. Each build uses its own commit's file, so a change to it in a pull request applies to that pull request's builds, and reaches the default branch when the pull request merges.
# yaml-language-server: $schema=https://visualci.com/visualci.schema.json
project: acme/web
ignore:
- snapshots: "api/invoices/**"
json_paths: ["$.generated_at", "$.items[*].id"]
- snapshots: "api/**/request_log.json"
json_paths: ["$..request_id"]
- snapshots: "emails/*.html"
text_patterns: ['Sent \d{4}-\d{2}-\d{2}']
threshold:
"screenshots/**": 0.1
"pdfs/**": 0
pdf:
engine: pdfbox
dpi: 140
ci_mode: review
uploads:
- path: spec/artifacts
- path: src
from: auto
The CLI looks for visualci.yml, .visualci.yml, visualci.yaml or .visualci.yaml, from the working directory up to the repository's root. VISUALCI_CONFIG names a file somewhere else. An invalid file stops build create with the error, so a build never runs with settings you didn't mean.
Where settings come from
- A field in the file wins for that build.
- A field the file leaves out comes from the project's Settings tab (or
update_projectover MCP). - A setting on one snapshot (
--threshold,--engine, a test'signore) wins over both.
The build's page shows the file it was sent, and get_build returns it as config. A text snapshot's page lists the ignore rules applied to it and where each came from.
Fields
| Field | What it does |
|---|---|
project |
organization/project. The token decides the project; the CLI warns when this names a different one. |
ignore |
Values in text snapshots that change on every run. A list of rules; see below. When the file has ignore, the project's own rules aren't used. |
threshold |
0 compares exactly; above 0 it's a colour threshold. One number for every snapshot, or a map of snapshot globs to thresholds. When several globs match, the longest glob (by its length in characters) wins. |
pdf.engine |
pdfbox or mutool. |
pdf.dpi |
Render resolution, 36 to 600. |
ci_mode |
review, wait or strict. The file can only make the project's mode stricter (in that order); a looser value is ignored, with a warning on the build. See GitLab CI. |
uploads |
What a bare visualci upload sends: a list of path (relative to the file), with optional from (jest, vitest, insta, syrupy, rspec or auto), prefix and format. |
Unknown fields are errors, so a misspelt field doesn't pass unnoticed.
Ignore rules
Each rule names the snapshots it applies to with snapshots, a glob over snapshot names as VisualCI shows them. Those names leave out the directory you uploaded: visualci upload api (or uploads: [{path: api}]) sends api/invoices/show.json as invoices/show, so its rule is snapshots: "invoices/**", not "api/invoices/**". visualci config check warns about a rule that matches none of the files under uploads, and a build lists any rule that matched none of its snapshots. There are no global rules: a rule without snapshots is an error. Use "**" when a rule really is for every snapshot.
*matches within one segment of the name and**across segments:api/*/log.jsonmatchesapi/users/log.json, andapi/**matches everything underapi/.json_pathsreplace values in JSON snapshots:$.generated_at,$.items[*].id,$..request_id(that key at any depth),$["odd key"].text_patternsare regular expressions, matched in every text format after normalizing.
Matching values become [ignored] on both sides before comparing. A new rule takes effect on the next build, without approving the baseline again.
Rules can also be set next to the assertion, for one snapshot only. The Ruby helpers take ignore:, and an upload manifest entry takes "ignore": {"json_paths": [...], "text_patterns": [...]}.
Changes to the file are reviewed
The file can change what counts as a change, so a pull request can't use it to let changes through unseen. When a build's ignore rules or thresholds could hide something its base build's would show (a new or wider rule, a higher threshold), the build gets a visualci.yml item next to its snapshots. It shows the rules and thresholds before and after, and it has to be approved like any other change. Removing rules or lowering a threshold needs no review.
Checking the file
visualci config check # exits 1 and prints the problem when the file is invalid
visualci config schema # prints the JSON Schema
The schema is also at visualci.com/visualci.schema.json. Editors with the YAML language server validate the file and complete its fields when it starts with the # yaml-language-server comment above.