Skip to content

Commit 5b1bcbb

Browse files
committed
Add example and update readme
1 parent 2a616dc commit 5b1bcbb

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ For more information take a look at the [quick start](#quick-start), the [exampl
4040
* [line-count](#line-count)
4141
* [not-contains](#not-contains)
4242
* [xml](#xml)
43+
* [file](#file)
4344
- [stderr](#stderr)
4445
- [skip](#skip)
4546
+ [Config](#user-content-config-config)
@@ -530,6 +531,21 @@ cat some.xml:
530531
</book>
531532
```
532533

534+
##### file
535+
536+
`file` is a file path, relative to the working directory that will have
537+
its entire contents matched against the command output. Other than
538+
reading from a file this works the same as [exactly](#exactly).
539+
540+
The example below will always pass.
541+
542+
```yaml
543+
output should match file:
544+
command: cat output.txt
545+
stdout:
546+
file: output.txt
547+
```
548+
533549
#### stderr
534550

535551
See [stdout](#stdout) for more information.

examples/_fixtures/output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
line one
2+
line two

examples/commander.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ tests:
2424
it should skip:
2525
command: echo "I should be skipped"
2626
stdout: I should be skipped
27-
skip: true
27+
skip: true
28+
29+
it should match file output:
30+
command: printf "line one\nline two"
31+
stdout:
32+
file: _fixtures/output.txt

0 commit comments

Comments
 (0)