Test Assertions Reference
Documents all available test assertion types for functional-examples.
meta-yml5 FILEStestingassertionsreference
All Example Files
FILE EXPLORER
assertions-reference.yml
1# This file documents all available test assertion types.
2# Each section is a region that can be embedded in documentation.
3
4assertions:
5 exitCode: 0 # Expected exit code (0 = success)
6
7assertions:
8 stdout:
9 contains: "expected text" # Substring match
10 matches: "pattern.*regex" # Regex match
11
12assertions:
13 stderr:
14 contains: "Error" # Substring match
15 matches: "Error:\\s+.*" # Regex match
16
17assertions:
18 file:
19 path: output.txt # File must exist
20 contains: "expected content" # File content substring
21 matches: "pattern" # File content regex
22 files: # Multiple file checks
23 - path: a.txt
24 contains: "content a"
25 - path: b.txt
26
27assertions:
28 dir:
29 path: output/ # Directory must exist
30 directories: # Multiple directory checks
31 - path: dist/
32 - path: generated/
33
34assertions:
35 snapshot:
36 path: output.txt # File to compare
37 snapshot: __snapshots__/expected.txt # Reference snapshot
38 snapshots: # Multiple snapshot checks
39 - path: a.txt
40 snapshot: __snapshots__/a.txt
41
42assertions:
43 not:
44 stdout:
45 contains: "ERROR"
46 file:
47 path: should-not-exist.txt
48