You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
yamlfmt has integration testing that tests invocations end-to-end.
4
+
5
+
## Run
6
+
7
+
Integration tests are excluded from `go test` by default using build tags. To build and execute the integration test, use:
8
+
9
+
```shell
10
+
make integrationtest
11
+
```
12
+
13
+
## Update
14
+
15
+
The "golden" / expected output files can be (re-)generated by the test framework. To do so, run:
16
+
17
+
```shell
18
+
make integrationtest_update
19
+
```
20
+
21
+
## Add new test case
22
+
23
+
* Run the following command to create the directory structure for the new test:
24
+
25
+
```shell
26
+
TESTNAME=my_new_test make command_test_case
27
+
```
28
+
* Add example input files to `testdata/${TESTNAME}/before`.
29
+
* Add the expected output to `testdata/${TESTNAME}/stdout/stdout.txt` if applicable.
30
+
*`make command_test_case` added a new Go test to `integrationtest/command/command_test.go`. Update the `yamlfmt` flags so the invokation uses the feature the test should cover.
31
+
* Run the following command to generate the expected "golden" output of the test:
32
+
33
+
```shell
34
+
make integrationtest_update
35
+
```
36
+
* Review the generated output to ensure it is expected.
0 commit comments