rspec_logfmt_formatter 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +82 -0
- data/lib/rspec_logfmt_formatter/formatter.rb +72 -0
- data/lib/rspec_logfmt_formatter/version.rb +3 -0
- data/lib/rspec_logfmt_formatter.rb +2 -0
- metadata +152 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 211c7cbe090b13a9762b825d0cfeb2aecb4e43f2d44037147efd158883144565
|
4
|
+
data.tar.gz: 46c20ba3d51965bdd6f8ceee5bdf4a3f14d9efaf3af5efb73f154ac675a55057
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 46ae8acd77714be862c4da0455cb5c553dbcc1fb05747e158f633323aa5246d46e72154ec0a346e042b735a5b1d645503a0ce5103242997116205ecf2bb86cf6
|
7
|
+
data.tar.gz: a95b1e04e094ae0067baeacffa3cce3a34a8097014c9066ebedbc6575999d22a957d0c7484981c73c3bb11bdc478134ea179f5386b6d357a6a430528e9fb1c67
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2022 carwow
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# RSpec logfmt Formatter
|
2
|
+
|
3
|
+
[](https://circleci.com/gh/carwow/rspec_logfmt_formatter/tree/master)
|
4
|
+
|
5
|
+
[RSpec][rspec] 3 results in the [logfmt][logfmt] format that you can push to you observability tool such as [Honeycomb][honeycomb]
|
6
|
+
|
7
|
+
[rspec]: http://rspec.info/
|
8
|
+
[logfmt]: https://brandur.org/logfmt
|
9
|
+
[honeycomb]: https://www.honeycomb.io/
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Install the gem:
|
14
|
+
<details>
|
15
|
+
<summary>WIP</summary>
|
16
|
+
|
17
|
+
```sh
|
18
|
+
gem install rspec_logfmt_formatter
|
19
|
+
```
|
20
|
+
|
21
|
+
</details>
|
22
|
+
|
23
|
+
Use it:
|
24
|
+
|
25
|
+
```sh
|
26
|
+
rspec --format RspecLogfmtFormatter::Formatter --out rspec.txt
|
27
|
+
```
|
28
|
+
|
29
|
+
You'll get a file `rspec.txt` with your results in it.
|
30
|
+
|
31
|
+
You can use it in combination with other [formatters][rspec-formatters], too:
|
32
|
+
|
33
|
+
```sh
|
34
|
+
rspec --format progress --format RspecLogfmtFormatter::Formatter --out rspec.txt
|
35
|
+
```
|
36
|
+
|
37
|
+
[rspec-formatters]: https://relishapp.com/rspec/rspec-core/v/3-6/docs/formatters
|
38
|
+
|
39
|
+
### Using in your project with Bundler
|
40
|
+
|
41
|
+
Add it to your Gemfile if you're using [Bundler][bundler]. Put it in the same groups as rspec.
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
group :test do
|
45
|
+
gem "rspec"
|
46
|
+
gem "rspec_logfmt_formatter"
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
Put the same arguments as the commands above in [your `.rspec`][rspec-file]:
|
51
|
+
|
52
|
+
```sh
|
53
|
+
--format RspecLogfmtFormatter::Formatter
|
54
|
+
--out rspec.txt
|
55
|
+
```
|
56
|
+
[bundler]: https://bundler.io
|
57
|
+
[rspec-file]: https://relishapp.com/rspec/rspec-core/v/3-6/docs/configuration/read-command-line-configuration-options-from-files
|
58
|
+
|
59
|
+
### Parallel tests
|
60
|
+
|
61
|
+
For use with `parallel_tests`, add `$TEST_ENV_NUMBER` in the output file option (in `.rspec` or `.rspec_parallel`) to avoid concurrent process write conflicts.
|
62
|
+
|
63
|
+
```sh
|
64
|
+
--format RspecLogfmtFormatter::Formatter
|
65
|
+
--out tmp/rspec<%= ENV["TEST_ENV_NUMBER"] %>.txt
|
66
|
+
```
|
67
|
+
|
68
|
+
### How to push to Honeycomb
|
69
|
+
|
70
|
+
TODO
|
71
|
+
|
72
|
+
## Development
|
73
|
+
|
74
|
+
TODO
|
75
|
+
|
76
|
+
## Releasing
|
77
|
+
|
78
|
+
TODO
|
79
|
+
|
80
|
+
## License
|
81
|
+
|
82
|
+
The MIT License, see [LICENSE](./LICENSE).
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rspec/core'
|
4
|
+
require 'rspec/core/formatters/base_formatter'
|
5
|
+
|
6
|
+
module RspecLogfmtFormatter
|
7
|
+
class Formatter < RSpec::Core::Formatters::BaseFormatter
|
8
|
+
RSpec::Core::Formatters.register self,
|
9
|
+
:start,
|
10
|
+
:stop,
|
11
|
+
:dump_summary
|
12
|
+
|
13
|
+
def start(notification)
|
14
|
+
@start_notification = notification
|
15
|
+
@started = Time.now
|
16
|
+
@retries = []
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def stop(notification)
|
21
|
+
@examples_notification = notification
|
22
|
+
end
|
23
|
+
|
24
|
+
def dump_summary(notification)
|
25
|
+
@summary_notification = notification
|
26
|
+
fmt_dump
|
27
|
+
end
|
28
|
+
|
29
|
+
def retry(example)
|
30
|
+
@retries << example
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
attr_reader :started, :retries
|
36
|
+
|
37
|
+
def example_count
|
38
|
+
@summary_notification.example_count
|
39
|
+
end
|
40
|
+
|
41
|
+
def pending_count
|
42
|
+
@summary_notification.pending_count
|
43
|
+
end
|
44
|
+
|
45
|
+
def failure_count
|
46
|
+
@summary_notification.failure_count
|
47
|
+
end
|
48
|
+
|
49
|
+
def duration
|
50
|
+
@summary_notification.duration
|
51
|
+
end
|
52
|
+
|
53
|
+
def error_count
|
54
|
+
if @summary_notification.respond_to?(:errors_outside_of_examples_count)
|
55
|
+
@summary_notification.errors_outside_of_examples_count
|
56
|
+
else
|
57
|
+
0
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# rubocop:disable Metrics/AbcSize
|
62
|
+
def fmt_dump
|
63
|
+
output << %( tests.name="rspec#{ENV['TEST_ENV_NUMBER']}")
|
64
|
+
output << %( tests.count="#{example_count}")
|
65
|
+
output << %( tests.skipped="#{pending_count}")
|
66
|
+
output << %( tests.failures="#{failure_count}")
|
67
|
+
output << %( tests.errors="#{error_count}")
|
68
|
+
output << %( tests.retries.count="#{retries.size}")
|
69
|
+
end
|
70
|
+
# rubocop:enable Metrics/AbcSize
|
71
|
+
end
|
72
|
+
end
|
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec_logfmt_formatter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Vickerstaff
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-01-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: carwow_rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.4.4
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.4.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec_junit_formatter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-retry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-core
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2'
|
104
|
+
- - "<"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '4'
|
107
|
+
type: :runtime
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '2'
|
114
|
+
- - "<"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '4'
|
117
|
+
description: ''
|
118
|
+
email:
|
119
|
+
- developers@carwow.co.uk
|
120
|
+
executables: []
|
121
|
+
extensions: []
|
122
|
+
extra_rdoc_files: []
|
123
|
+
files:
|
124
|
+
- LICENSE
|
125
|
+
- README.md
|
126
|
+
- lib/rspec_logfmt_formatter.rb
|
127
|
+
- lib/rspec_logfmt_formatter/formatter.rb
|
128
|
+
- lib/rspec_logfmt_formatter/version.rb
|
129
|
+
homepage: https://github.com/carwow/rspec_logfmt_formatter
|
130
|
+
licenses:
|
131
|
+
- MIT
|
132
|
+
metadata: {}
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 2.7.0
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 2.0.0
|
147
|
+
requirements: []
|
148
|
+
rubygems_version: 3.1.4
|
149
|
+
signing_key:
|
150
|
+
specification_version: 4
|
151
|
+
summary: RSpec formatter that honeycomb can read
|
152
|
+
test_files: []
|