File tree 2 files changed +23
-1
lines changed 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
10
10
11
11
For a steady stream of TILs, [ sign up for my newsletter] ( https://crafty-builder-6996.ck.page/e169c61186 ) .
12
12
13
- _ 1338 TILs and counting..._
13
+ _ 1339 TILs and counting..._
14
14
15
15
---
16
16
@@ -1020,6 +1020,7 @@ _1338 TILs and counting..._
1020
1020
1021
1021
- [ Check Specific Arguments To Received Method] ( rspec/check-specific-arguments-to-received-method.md )
1022
1022
- [ Find Minimal Set Of Tests Causing A Flicker] ( rspec/find-minimal-set-of-tests-causing-a-flicker.md )
1023
+ - [ Format Test Results As A JSON File] ( rspec/format-test-results-as-a-json-file.md )
1023
1024
- [ Run Tests With Documentation Formatting] ( rspec/run-tests-with-documentation-formatting.md )
1024
1025
- [ Use Specific Cache Store In A Single Test] ( rspec/use-specific-cache-store-in-a-single-test.md )
1025
1026
Original file line number Diff line number Diff line change
1
+ # Format Test Results As A JSON File
2
+
3
+ The most common output format for RSpec test results is _ progress_ which shows
4
+ the dot (` . ` ) or ` F ` for each test pass and fail. RSpec supports other formats,
5
+ including JSON.
6
+
7
+ You'd typically want to use the JSON format when you want to programmatically
8
+ work with the results. And the results would be most accessible if they ended
9
+ up in a file.
10
+
11
+ So, when formatting the results to JSON, we typically also want to specify an
12
+ output file. We'll need to use two flags — ` --format ` and ` --out ` .
13
+
14
+ ``` bash
15
+ $ rspec --format json --out test_run_1.json
16
+ ```
17
+
18
+ When this test run completes, we will have the results in JSON format in the
19
+ newly created ` test_run_1.json ` file in the current directory.
20
+
21
+ See ` rspec --help ` for more details.
You can’t perform that action at this time.
0 commit comments