test-prof 0.7.5 → 0.9.0
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 +4 -4
- data/CHANGELOG.md +174 -107
- data/LICENSE.txt +1 -1
- data/README.md +9 -3
- data/lib/minitest/base_reporter.rb +18 -12
- data/lib/minitest/test_prof_plugin.rb +8 -8
- data/lib/test_prof/any_fixture.rb +3 -3
- data/lib/test_prof/before_all/adapters/active_record.rb +11 -0
- data/lib/test_prof/before_all/isolator.rb +18 -0
- data/lib/test_prof/before_all.rb +82 -2
- data/lib/test_prof/cops/rspec/aggregate_failures.rb +6 -6
- data/lib/test_prof/event_prof/custom_events/factory_create.rb +27 -45
- data/lib/test_prof/event_prof/custom_events/sidekiq_inline.rb +8 -38
- data/lib/test_prof/event_prof/custom_events/sidekiq_jobs.rb +7 -25
- data/lib/test_prof/event_prof/instrumentations/active_support.rb +1 -1
- data/lib/test_prof/event_prof/minitest.rb +4 -4
- data/lib/test_prof/event_prof/monitor.rb +45 -8
- data/lib/test_prof/event_prof/rspec.rb +4 -11
- data/lib/test_prof/event_prof.rb +6 -6
- data/lib/test_prof/ext/factory_bot_strategy.rb +24 -0
- data/lib/test_prof/factory_bot.rb +1 -1
- data/lib/test_prof/factory_default.rb +1 -1
- data/lib/test_prof/factory_doctor/fabrication_patch.rb +12 -0
- data/lib/test_prof/factory_doctor/factory_bot_patch.rb +5 -1
- data/lib/test_prof/factory_doctor/minitest.rb +4 -4
- data/lib/test_prof/factory_doctor/rspec.rb +15 -12
- data/lib/test_prof/factory_doctor.rb +29 -7
- data/lib/test_prof/factory_prof/factory_builders/fabrication.rb +1 -1
- data/lib/test_prof/factory_prof/factory_builders/factory_bot.rb +2 -17
- data/lib/test_prof/factory_prof/printers/flamegraph.rb +6 -2
- data/lib/test_prof/factory_prof/printers/simple.rb +8 -6
- data/lib/test_prof/factory_prof.rb +29 -15
- data/lib/test_prof/recipes/logging.rb +86 -21
- data/lib/test_prof/recipes/minitest/before_all.rb +3 -2
- data/lib/test_prof/recipes/minitest/sample.rb +5 -5
- data/lib/test_prof/recipes/rspec/any_fixture.rb +3 -1
- data/lib/test_prof/recipes/rspec/before_all.rb +12 -3
- data/lib/test_prof/recipes/rspec/factory_all_stub.rb +5 -1
- data/lib/test_prof/recipes/rspec/let_it_be.rb +27 -12
- data/lib/test_prof/rspec_dissect/rspec.rb +2 -6
- data/lib/test_prof/rspec_dissect.rb +13 -19
- data/lib/test_prof/rspec_stamp/parser.rb +1 -1
- data/lib/test_prof/rspec_stamp/rspec.rb +1 -1
- data/lib/test_prof/rspec_stamp.rb +14 -14
- data/lib/test_prof/ruby_prof/rspec.rb +2 -6
- data/lib/test_prof/ruby_prof.rb +32 -24
- data/lib/test_prof/stack_prof/rspec.rb +5 -6
- data/lib/test_prof/stack_prof.rb +23 -15
- data/lib/test_prof/tag_prof/printers/simple.rb +4 -4
- data/lib/test_prof/tag_prof/result.rb +3 -3
- data/lib/test_prof/tag_prof/rspec.rb +9 -14
- data/lib/test_prof/utils/html_builder.rb +1 -1
- data/lib/test_prof/utils/sized_ordered_set.rb +1 -1
- data/lib/test_prof/version.rb +1 -1
- data/lib/test_prof.rb +6 -12
- metadata +35 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6cf66f80707806f1378f3164e1376e6ee8fe5c3472d0704ef865de4939852283
|
|
4
|
+
data.tar.gz: 472ea3dde66363470b5e62995548760359f5ecd358b84099d12d9a622b36063d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4c21d8cae35943af31f72617a20b11d653ade888ba264c510dbe1fc365052a3ed7c7e04a7516b967a4f47dcb2442754a0d4e60053c385ae859963b666d239f9e
|
|
7
|
+
data.tar.gz: 7615a8bdb3d087c254333c265ffd759d13b51e76c6913d8e38a6856bdc036303f096ef2f2fb83c1b867024a87fe4989635105361103e85d7e1f4b14c0ae584bd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,75 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
-
## master
|
|
3
|
+
## master (unreleased)
|
|
4
|
+
|
|
5
|
+
## 0.9.0 (2019-05-14)
|
|
6
|
+
|
|
7
|
+
- Add threshold and custom event support to FactoryDoctor. ([@palkan][])
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
$ FDOC=1 FDOC_EVENT="sql.rom" FDOC_THRESHOLD=0.1 rspec
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Add Fabrication support to FactoryDoctor. ([@palkan][])
|
|
14
|
+
|
|
15
|
+
- Add `guard` and `top_level` options to `EventProf::Monitor`. ([@palkan][])
|
|
16
|
+
|
|
17
|
+
For example:
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
TestProf::EventProf.monitor(
|
|
21
|
+
Sidekiq::Client,
|
|
22
|
+
"sidekiq.inline",
|
|
23
|
+
:raw_push,
|
|
24
|
+
top_level: true,
|
|
25
|
+
guard: ->(*) { Sidekiq::Testing.inline? }
|
|
26
|
+
)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Add global `before_all` hooks. ([@danielwaterworth][], [@palkan][])
|
|
30
|
+
|
|
31
|
+
Now you can run additional code before and after every `before_all` transaction
|
|
32
|
+
begins and rollbacks:
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
TestProf::BeforeAll.configure do |config|
|
|
36
|
+
config.before(:begin) do
|
|
37
|
+
# do something before transaction opens
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
config.after(:rollback) do
|
|
41
|
+
# do something after transaction closes
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- Add ability to use `let_it_be` aliases with predefined options. ([@danielwaterworth][])
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
TestProf::LetItBe.configure do |config|
|
|
50
|
+
config.alias_to :let_it_be_with_refind, refind: true
|
|
51
|
+
end
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- Made FactoryProf measure and report on timing ([@danielwaterworth][])
|
|
55
|
+
|
|
56
|
+
## 0.8.0 (2019-04-12) 🚀
|
|
57
|
+
|
|
58
|
+
- **Ruby 2.4+ is requiered** ([@palkan][])
|
|
59
|
+
|
|
60
|
+
- **RSpec 3.5+ is requiered for RSpec features** ([@palkan][])
|
|
61
|
+
|
|
62
|
+
- Make `before_all` compatible with [`isolator`](https://github.com/palkan/isolator). ([@palkan][])
|
|
63
|
+
|
|
64
|
+
- Add `with_logging` and `with_ar_logging` helpers to logging recipe. ([@palkan][])
|
|
65
|
+
|
|
66
|
+
- Make `before_all` for Active Record `lock_thread` aware. ([@palkan][])
|
|
67
|
+
|
|
68
|
+
`before_all` can went crazy if you open multiple connections within it
|
|
69
|
+
(since it tracks the number of open transactions).
|
|
70
|
+
Rails 5+ `lock_thread` feature only locks the connection thread in
|
|
71
|
+
`before`/`setup` hook thus making it possible to have multiple connections/transactions
|
|
72
|
+
in `before_all` (e.g. performing jobs with Active Job async adapter).
|
|
4
73
|
|
|
5
74
|
## 0.7.5 (2019-02-22)
|
|
6
75
|
|
|
@@ -20,10 +89,10 @@
|
|
|
20
89
|
|
|
21
90
|
- Improve test sampling.([@mkldon][])
|
|
22
91
|
|
|
23
|
-
|
|
24
|
-
SAMPLE=10 rake test # runs 10 random test examples
|
|
25
|
-
SAMPLE_GROUPS=10 rake test # runs 10 random example groups
|
|
26
|
-
|
|
92
|
+
```bash
|
|
93
|
+
$ SAMPLE=10 rake test # runs 10 random test examples
|
|
94
|
+
$ SAMPLE_GROUPS=10 rake test # runs 10 random example groups
|
|
95
|
+
```
|
|
27
96
|
|
|
28
97
|
- Extend Event Prof formatter to include the absolute run time and the percentage of the event tim [#100](https://github.com/palkan/test-prof/issues/100) ([@dmagro][])
|
|
29
98
|
|
|
@@ -35,32 +104,32 @@
|
|
|
35
104
|
|
|
36
105
|
- Add ability to ignore connection configurations in shared connection.([@palkan][])
|
|
37
106
|
|
|
38
|
-
Example:
|
|
107
|
+
Example:
|
|
39
108
|
|
|
40
|
-
```ruby
|
|
41
|
-
# Do not use shared connection for sqlite db
|
|
42
|
-
TestProf::ActiveRecordSharedConnection.ignore { |config| config[:adapter] == "sqlite3" }
|
|
43
|
-
```
|
|
109
|
+
```ruby
|
|
110
|
+
# Do not use shared connection for sqlite db
|
|
111
|
+
TestProf::ActiveRecordSharedConnection.ignore { |config| config[:adapter] == "sqlite3" }
|
|
112
|
+
```
|
|
44
113
|
|
|
45
114
|
## 0.7.0 (2018-08-12)
|
|
46
115
|
|
|
47
116
|
- **Ruby 2.3+ is required**. ([@palkan][])
|
|
48
117
|
|
|
49
|
-
Ruby 2.2 EOL was on 2018-03-31.
|
|
118
|
+
Ruby 2.2 EOL was on 2018-03-31.
|
|
50
119
|
|
|
51
120
|
- Upgrade RubyProf integration to `ruby-prof >= 0.17`. ([@palkan][])
|
|
52
121
|
|
|
53
|
-
Use `exclude_common_methods!` instead of the deprecated `eliminate_methods!`.
|
|
122
|
+
Use `exclude_common_methods!` instead of the deprecated `eliminate_methods!`.
|
|
54
123
|
|
|
55
|
-
Add RSpec specific exclusions.
|
|
124
|
+
Add RSpec specific exclusions.
|
|
56
125
|
|
|
57
|
-
Add ability to specify custom exclusions through `config.custom_exclusions`, e.g.:
|
|
126
|
+
Add ability to specify custom exclusions through `config.custom_exclusions`, e.g.:
|
|
58
127
|
|
|
59
|
-
```ruby
|
|
60
|
-
TestProf::RubyProf.configure do |config|
|
|
61
|
-
|
|
62
|
-
end
|
|
63
|
-
```
|
|
128
|
+
```ruby
|
|
129
|
+
TestProf::RubyProf.configure do |config|
|
|
130
|
+
config.custom_exclusions = {User => %i[save save!]}
|
|
131
|
+
end
|
|
132
|
+
```
|
|
64
133
|
|
|
65
134
|
## 0.6.0 (2018-06-29)
|
|
66
135
|
|
|
@@ -68,25 +137,24 @@ end
|
|
|
68
137
|
|
|
69
138
|
- Add `EventProf.monitor` to instrument arbitrary methods. ([@palkan][])
|
|
70
139
|
|
|
71
|
-
Add custom instrumetation easily:
|
|
140
|
+
Add custom instrumetation easily:
|
|
72
141
|
|
|
73
|
-
```ruby
|
|
74
|
-
class Work
|
|
75
|
-
|
|
76
|
-
|
|
142
|
+
```ruby
|
|
143
|
+
class Work
|
|
144
|
+
def do
|
|
145
|
+
# ...
|
|
146
|
+
end
|
|
77
147
|
end
|
|
78
|
-
end
|
|
79
148
|
|
|
80
|
-
# Instrument Work#do calls with "my.work" event
|
|
81
|
-
TestProf::EventProf.monitor(Work, "my.work", :do)
|
|
82
|
-
```
|
|
149
|
+
# Instrument Work#do calls with "my.work" event
|
|
150
|
+
TestProf::EventProf.monitor(Work, "my.work", :do)
|
|
151
|
+
```
|
|
83
152
|
|
|
84
153
|
[📝 Docs](https://test-prof.evilmartians.io/#/event_prof?id=profile-arbitrary-methods)
|
|
85
154
|
|
|
86
155
|
- Adapterize `before_all`. ([@palkan][])
|
|
87
156
|
|
|
88
|
-
Now it's possible to write your own adapter for `before_all` to manage
|
|
89
|
-
transactions.
|
|
157
|
+
Now it's possible to write your own adapter for `before_all` to manage transactions.
|
|
90
158
|
|
|
91
159
|
[📝 Docs](https://test-prof.evilmartians.io/#/before_all?id=database-adapters)
|
|
92
160
|
|
|
@@ -98,32 +166,32 @@ transactions.
|
|
|
98
166
|
|
|
99
167
|
- Show top `let` declarations per example group in RSpecDissect profiler. ([@palkan][])
|
|
100
168
|
|
|
101
|
-
The output now includes the following information:
|
|
169
|
+
The output now includes the following information:
|
|
102
170
|
|
|
103
|
-
```
|
|
104
|
-
Top 5 slowest suites (by `let` time):
|
|
171
|
+
```
|
|
172
|
+
Top 5 slowest suites (by `let` time):
|
|
105
173
|
|
|
106
|
-
FunnelsController (./spec/controllers/funnels_controller_spec.rb:3) – 00:38.532 of 00:43.649 (133)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
ApplicantsController (./spec/controllers/applicants_controller_spec.rb:3) – 00:33.252 of 00:41.407 (222)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
174
|
+
FunnelsController (./spec/controllers/funnels_controller_spec.rb:3) – 00:38.532 of 00:43.649 (133)
|
|
175
|
+
↳ user – 3
|
|
176
|
+
↳ funnel – 2
|
|
177
|
+
ApplicantsController (./spec/controllers/applicants_controller_spec.rb:3) – 00:33.252 of 00:41.407 (222)
|
|
178
|
+
↳ user – 10
|
|
179
|
+
↳ funnel – 5
|
|
180
|
+
```
|
|
113
181
|
|
|
114
|
-
Enabled by default. Disable it with:
|
|
182
|
+
Enabled by default. Disable it with:
|
|
115
183
|
|
|
116
|
-
```ruby
|
|
117
|
-
TestProf::RSpecDissect.configure do |config|
|
|
118
|
-
|
|
119
|
-
end
|
|
120
|
-
```
|
|
184
|
+
```ruby
|
|
185
|
+
TestProf::RSpecDissect.configure do |config|
|
|
186
|
+
config.let_stats_enabled = false
|
|
187
|
+
end
|
|
188
|
+
```
|
|
121
189
|
|
|
122
190
|
- [Fix [#80](https://github.com/palkan/test-prof/issues/80)] Added ability to preserve traits. ([@Vasfed][])
|
|
123
191
|
|
|
124
|
-
Disabled by default for compatibility. Enable globally by `FactoryDefault.preserve_traits = true` or for single `create_default`: `create_default(:user, preserve_traits: true)`
|
|
192
|
+
Disabled by default for compatibility. Enable globally by `FactoryDefault.preserve_traits = true` or for single `create_default`: `create_default(:user, preserve_traits: true)`
|
|
125
193
|
|
|
126
|
-
When enabled - default object will be used only when there's no [traits](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#traits) in association.
|
|
194
|
+
When enabled - default object will be used only when there's no [traits](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#traits) in association.
|
|
127
195
|
|
|
128
196
|
- Add ability to run only `let` or `before` profiler with RSpecDissect. ([@palkan][])
|
|
129
197
|
|
|
@@ -133,8 +201,8 @@ When enabled - default object will be used only when there's no [traits](https:/
|
|
|
133
201
|
|
|
134
202
|
- [Fix [#75](https://github.com/palkan/test-prof/issues/75)] Fix `RSpec/Aggregate` failures with non-regular examples. ([@palkan][])
|
|
135
203
|
|
|
136
|
-
Do not take into account `xit`, `pending`, `its`, etc. examples,
|
|
137
|
-
only consider regular `it`, `specify`, `scenario`, `example`.
|
|
204
|
+
Do not take into account `xit`, `pending`, `its`, etc. examples,
|
|
205
|
+
only consider regular `it`, `specify`, `scenario`, `example`.
|
|
138
206
|
|
|
139
207
|
## 0.5.0 (2018-04-25)
|
|
140
208
|
|
|
@@ -142,78 +210,78 @@ only consider regular `it`, `specify`, `scenario`, `example`.
|
|
|
142
210
|
|
|
143
211
|
- Add events support to TagProf. ([@palkan][])
|
|
144
212
|
|
|
145
|
-
Example usage:
|
|
213
|
+
Example usage:
|
|
146
214
|
|
|
147
|
-
```sh
|
|
148
|
-
TAG_PROF=type TAG_PROF_EVENT=sql.active_record rspec
|
|
149
|
-
```
|
|
215
|
+
```sh
|
|
216
|
+
TAG_PROF=type TAG_PROF_EVENT=sql.active_record rspec
|
|
217
|
+
```
|
|
150
218
|
|
|
151
|
-
[📝 Docs](https://test-prof.evilmartians.io/#/tag_prof?id=profiling-events)
|
|
219
|
+
[📝 Docs](https://test-prof.evilmartians.io/#/tag_prof?id=profiling-events)
|
|
152
220
|
|
|
153
221
|
- Add logging helpers for Rails. ([@palkan][])
|
|
154
222
|
|
|
155
|
-
|
|
223
|
+
Enable verbose logging globally:
|
|
156
224
|
|
|
157
|
-
```sh
|
|
158
|
-
LOG=all rspec
|
|
159
|
-
```
|
|
225
|
+
```sh
|
|
226
|
+
LOG=all rspec
|
|
227
|
+
```
|
|
160
228
|
|
|
161
|
-
Or per example (group):
|
|
229
|
+
Or per example (group):
|
|
162
230
|
|
|
163
|
-
```ruby
|
|
164
|
-
it
|
|
165
|
-
|
|
166
|
-
end
|
|
167
|
-
```
|
|
231
|
+
```ruby
|
|
232
|
+
it "does smth weird", :log do
|
|
233
|
+
# ...
|
|
234
|
+
end
|
|
235
|
+
```
|
|
168
236
|
|
|
169
|
-
[📝 Docs](https://test-prof.evilmartians.io/#/logging)
|
|
237
|
+
[📝 Docs](https://test-prof.evilmartians.io/#/logging)
|
|
170
238
|
|
|
171
239
|
- Add HTML report for `TagProf`. ([@palkan][])
|
|
172
240
|
|
|
173
|
-
Generate HTML report by setting `TAG_PROF_FORMAT` to `html`.
|
|
241
|
+
Generate HTML report by setting `TAG_PROF_FORMAT` to `html`.
|
|
174
242
|
|
|
175
243
|
- Add ability to track multiple events at the same time with `EventProf`. ([@palkan][])
|
|
176
244
|
|
|
177
245
|
- Add `AnyFixture` DSL. ([@palkan][])
|
|
178
246
|
|
|
179
|
-
Example:
|
|
247
|
+
Example:
|
|
180
248
|
|
|
181
|
-
```ruby
|
|
182
|
-
# Enable DSL
|
|
183
|
-
using TestProf::AnyFixture::DSL
|
|
249
|
+
```ruby
|
|
250
|
+
# Enable DSL
|
|
251
|
+
using TestProf::AnyFixture::DSL
|
|
184
252
|
|
|
185
|
-
# and then you can use `fixture` method (which is just an alias for `TestProf::AnyFixture.register`)
|
|
186
|
-
before(:all) { fixture(:account) }
|
|
253
|
+
# and then you can use `fixture` method (which is just an alias for `TestProf::AnyFixture.register`)
|
|
254
|
+
before(:all) { fixture(:account) }
|
|
187
255
|
|
|
188
|
-
# You can also use it to fetch the record (instead of storing it in instance variable)
|
|
189
|
-
let(:account) { fixture(:account) }
|
|
190
|
-
```
|
|
256
|
+
# You can also use it to fetch the record (instead of storing it in instance variable)
|
|
257
|
+
let(:account) { fixture(:account) }
|
|
258
|
+
```
|
|
191
259
|
|
|
192
|
-
[📝 Docs](https://test-prof.evilmartians.io/#/any_fixture?id=dsl)
|
|
260
|
+
[📝 Docs](https://test-prof.evilmartians.io/#/any_fixture?id=dsl)
|
|
193
261
|
|
|
194
262
|
- Add `AnyFixture` usage report. ([@palkan][])
|
|
195
263
|
|
|
196
|
-
Enable `AnyFixture` usage reporting with `ANYFIXTURE_REPORTING=1` or with:
|
|
264
|
+
Enable `AnyFixture` usage reporting with `ANYFIXTURE_REPORTING=1` or with:
|
|
197
265
|
|
|
198
|
-
```ruby
|
|
199
|
-
TestProf::AnyFixture.reporting_enabled = true
|
|
200
|
-
```
|
|
266
|
+
```ruby
|
|
267
|
+
TestProf::AnyFixture.reporting_enabled = true
|
|
268
|
+
```
|
|
201
269
|
|
|
202
|
-
[📝 Docs](https://test-prof.evilmartians.io/#/any_fixture?id=usage-report)
|
|
270
|
+
[📝 Docs](https://test-prof.evilmartians.io/#/any_fixture?id=usage-report)
|
|
203
271
|
|
|
204
272
|
- Add `ActiveRecordSharedConnection` recipe. ([@palkan][])
|
|
205
273
|
|
|
206
|
-
Force ActiveRecord to use the same connection between threads (to avoid database cleaning in browser tests).
|
|
274
|
+
Force ActiveRecord to use the same connection between threads (to avoid database cleaning in browser tests).
|
|
207
275
|
|
|
208
|
-
[📝 Docs](https://test-prof.evilmartians.io/#/active_record_shared_connection)
|
|
276
|
+
[📝 Docs](https://test-prof.evilmartians.io/#/active_record_shared_connection)
|
|
209
277
|
|
|
210
278
|
- [#70](https://github.com/palkan/test-prof/pull/70) Add `FactoryAllStub` recipe. ([@palkan][])
|
|
211
279
|
|
|
212
|
-
[📝 Docs](https://test-prof.evilmartians.io/#/factory_all_stub)
|
|
280
|
+
[📝 Docs](https://test-prof.evilmartians.io/#/factory_all_stub)
|
|
213
281
|
|
|
214
282
|
- Add `ActiveRecordRefind` refinement. ([@palkan][])
|
|
215
283
|
|
|
216
|
-
[📝 Docs](https://test-prof.evilmartians.io/#/any_fixture?id=activerecordrefind)
|
|
284
|
+
[📝 Docs](https://test-prof.evilmartians.io/#/any_fixture?id=activerecordrefind)
|
|
217
285
|
|
|
218
286
|
### Fixes & Improvements
|
|
219
287
|
|
|
@@ -277,15 +345,15 @@ Force ActiveRecord to use the same connection between threads (to avoid database
|
|
|
277
345
|
|
|
278
346
|
- [#44](https://github.com/palkan/test-prof/pull/44) Support older versions of RSpec. ([@palkan][])
|
|
279
347
|
|
|
280
|
-
Support RSpec 3.1.0+ in general.
|
|
348
|
+
Support RSpec 3.1.0+ in general.
|
|
281
349
|
|
|
282
|
-
`let_it_be` supports only RSpec 3.3.0+.
|
|
350
|
+
`let_it_be` supports only RSpec 3.3.0+.
|
|
283
351
|
|
|
284
|
-
RSpecDissect `let` tracking supports only RSpec 3.3.0+.
|
|
352
|
+
RSpecDissect `let` tracking supports only RSpec 3.3.0+.
|
|
285
353
|
|
|
286
354
|
- [#38](https://github.com/palkan/test-prof/pull/38) Factory Doctor Minitest integration. ([@IDolgirev][])
|
|
287
355
|
|
|
288
|
-
It is possible now to use Factory Doctor with Minitest
|
|
356
|
+
It is possible now to use Factory Doctor with Minitest
|
|
289
357
|
|
|
290
358
|
## 0.4.0 (2017-10-03)
|
|
291
359
|
|
|
@@ -293,7 +361,7 @@ It is possible now to use Factory Doctor with Minitest
|
|
|
293
361
|
|
|
294
362
|
- [#29](https://github.com/palkan/test-prof/pull/29) EventProf Minitest integration. ([@IDolgirev][])
|
|
295
363
|
|
|
296
|
-
It is possible now to use Event Prof with Minitest
|
|
364
|
+
It is possible now to use Event Prof with Minitest
|
|
297
365
|
|
|
298
366
|
- [#30](https://github.com/palkan/test-prof/pull/30) Fabrication support for FactoryProf. ([@Shkrt][])
|
|
299
367
|
|
|
@@ -305,26 +373,25 @@ FactoryProf now also accounts objects created by Fabrication gem (in addition to
|
|
|
305
373
|
|
|
306
374
|
- Combine RSpecStamp with FactoryDoctor. ([@palkan][])
|
|
307
375
|
|
|
308
|
-
Automatically mark _bad_ examples with custom tags.
|
|
376
|
+
Automatically mark _bad_ examples with custom tags.
|
|
309
377
|
|
|
310
378
|
- [#17](https://github.com/palkan/test-prof/pull/17) Combine RSpecStamp with EventProf and RSpecDissect. ([@palkan][])
|
|
311
379
|
|
|
312
|
-
It is possible now to automatically mark _slow_ examples and groups with custom tags. For example:
|
|
380
|
+
It is possible now to automatically mark _slow_ examples and groups with custom tags. For example:
|
|
313
381
|
|
|
314
|
-
```sh
|
|
315
|
-
EVENT_PROF="sql.active_record" EVENT_PROF_STAMP="slow:sql" rspec ...
|
|
316
|
-
```
|
|
382
|
+
```sh
|
|
383
|
+
$ EVENT_PROF="sql.active_record" EVENT_PROF_STAMP="slow:sql" rspec ...
|
|
384
|
+
```
|
|
317
385
|
|
|
318
|
-
After running the command above the top 5 slowest example groups would be marked with `slow: :sql` tag.
|
|
386
|
+
After running the command above the top 5 slowest example groups would be marked with `slow: :sql` tag.
|
|
319
387
|
|
|
320
388
|
- [#14](https://github.com/palkan/test-prof/pull/14) RSpecDissect profiler. ([@palkan][])
|
|
321
389
|
|
|
322
|
-
RSpecDissect tracks how much time do you spend in `before` hooks
|
|
323
|
-
and memoization helpers (i.e. `let`) in your tests.
|
|
390
|
+
RSpecDissect tracks how much time do you spend in `before` hooks and memoization helpers (i.e. `let`) in your tests.
|
|
324
391
|
|
|
325
392
|
- [#13](https://github.com/palkan/test-prof/pull/13) RSpec `let_it_be` method. ([@palkan][])
|
|
326
393
|
|
|
327
|
-
Just like `let`, but persist the result for the whole group (i.e. `let` + `before_all`).
|
|
394
|
+
Just like `let`, but persist the result for the whole group (i.e. `let` + `before_all`).
|
|
328
395
|
|
|
329
396
|
### Improvements:
|
|
330
397
|
|
|
@@ -344,7 +411,7 @@ Just like `let`, but persist the result for the whole group (i.e. `let` + `befor
|
|
|
344
411
|
|
|
345
412
|
- EventProf: Fix regression bug with examples profiling. ([@palkan][])
|
|
346
413
|
|
|
347
|
-
There was a bug when an event occurs before the example has started (e.g. in `before(:context)` hook).
|
|
414
|
+
There was a bug when an event occurs before the example has started (e.g. in `before(:context)` hook).
|
|
348
415
|
|
|
349
416
|
## 0.2.3 (2017-08-28)
|
|
350
417
|
|
|
@@ -354,8 +421,7 @@ There was a bug when an event occurs before the example has started (e.g. in `be
|
|
|
354
421
|
|
|
355
422
|
- Fix time calculation when Time class is monkey-patched. ([@palkan][])
|
|
356
423
|
|
|
357
|
-
Add `TestProf.now` method which is just a copy of original `Time.now` and
|
|
358
|
-
use it everywhere.
|
|
424
|
+
Add `TestProf.now` method which is just a copy of original `Time.now` and use it everywhere.
|
|
359
425
|
|
|
360
426
|
Fixes [#10](https://github.com/palkan/test-prof/issues/10).
|
|
361
427
|
|
|
@@ -363,17 +429,17 @@ Fixes [#10](https://github.com/palkan/test-prof/issues/10).
|
|
|
363
429
|
|
|
364
430
|
- Detect `RSpec` by checking the presence of `RSpec::Core`. ([@palkan][])
|
|
365
431
|
|
|
366
|
-
Fixes [#8](https://github.com/palkan/test-prof/issues/8).
|
|
432
|
+
Fixes [#8](https://github.com/palkan/test-prof/issues/8).
|
|
367
433
|
|
|
368
434
|
## 0.2.0 (2017-08-18)
|
|
369
435
|
|
|
370
436
|
- Ensure output directory exists. ([@danielwestendorf][])
|
|
371
437
|
|
|
372
|
-
**Change default output dir** to "tmp/test_prof".
|
|
438
|
+
**Change default output dir** to "tmp/test_prof".
|
|
373
439
|
|
|
374
|
-
Rename `#artefact_path` to `#artifact_path` to be more US-like
|
|
440
|
+
Rename `#artefact_path` to `#artifact_path` to be more US-like
|
|
375
441
|
|
|
376
|
-
Ensure output dir exists in `#artifact_path` method.
|
|
442
|
+
Ensure output dir exists in `#artifact_path` method.
|
|
377
443
|
|
|
378
444
|
- FactoryDoctor: print success message when no bad examples found. ([@palkan][])
|
|
379
445
|
|
|
@@ -396,3 +462,4 @@ Ensure output dir exists in `#artifact_path` method.
|
|
|
396
462
|
[@szemek]: https://github.com/szemek
|
|
397
463
|
[@mkldon]: https://github.com/mkldon
|
|
398
464
|
[@dmagro]: https://github.com/dmagro
|
|
465
|
+
[@danielwaterworth]: https://github.com/danielwaterworth
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -33,9 +33,11 @@ Of course, we have some [solutions](https://test-prof.evilmartians.io/#/?id=reci
|
|
|
33
33
|
|
|
34
34
|
Supported Ruby versions:
|
|
35
35
|
|
|
36
|
-
- Ruby (MRI) >= 2.
|
|
36
|
+
- Ruby (MRI) >= 2.4.0 (**NOTE:** for Ruby 2.2 use TestProf < 0.7.0 or Ruby 2.3 use TestProf ~> 0.7.0)
|
|
37
37
|
|
|
38
|
-
- JRuby >= 9.1.0.0
|
|
38
|
+
- JRuby >= 9.1.0.0 (**NOTE:** refinements-dependent features might require 9.2.7+)
|
|
39
|
+
|
|
40
|
+
Supported RSpec version (for RSpec features only): >= 3.5.0 (for older RSpec versions use TestProf < 0.8.0).
|
|
39
41
|
|
|
40
42
|
<a href="https://evilmartians.com/">
|
|
41
43
|
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
|
|
@@ -62,7 +64,7 @@ Add `test-prof` gem to your application:
|
|
|
62
64
|
|
|
63
65
|
```ruby
|
|
64
66
|
group :test do
|
|
65
|
-
gem
|
|
67
|
+
gem "test-prof"
|
|
66
68
|
end
|
|
67
69
|
```
|
|
68
70
|
|
|
@@ -83,3 +85,7 @@ Already using TestProf? [Share your story!](https://github.com/palkan/test-prof/
|
|
|
83
85
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
84
86
|
|
|
85
87
|
[docs]: https://test-prof.evilmartians.io
|
|
88
|
+
|
|
89
|
+
## Security Contact
|
|
90
|
+
|
|
91
|
+
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require "minitest"
|
|
4
|
+
require "test_prof/logging"
|
|
5
5
|
|
|
6
6
|
module Minitest
|
|
7
7
|
module TestProf
|
|
@@ -15,17 +15,23 @@ module Minitest
|
|
|
15
15
|
inject_to_minitest_reporters if defined? Minitest::Reporters
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def start
|
|
18
|
+
def start
|
|
19
|
+
end
|
|
19
20
|
|
|
20
|
-
def prerecord(group, example)
|
|
21
|
+
def prerecord(group, example)
|
|
22
|
+
end
|
|
21
23
|
|
|
22
|
-
def before_test(test)
|
|
24
|
+
def before_test(test)
|
|
25
|
+
end
|
|
23
26
|
|
|
24
|
-
def record(*)
|
|
27
|
+
def record(*)
|
|
28
|
+
end
|
|
25
29
|
|
|
26
|
-
def after_test(test)
|
|
30
|
+
def after_test(test)
|
|
31
|
+
end
|
|
27
32
|
|
|
28
|
-
def report
|
|
33
|
+
def report
|
|
34
|
+
end
|
|
29
35
|
|
|
30
36
|
private
|
|
31
37
|
|
|
@@ -33,22 +39,22 @@ module Minitest
|
|
|
33
39
|
# Minitest::Result (>= 5.11) has `source_location` method
|
|
34
40
|
return group.source_location if group.respond_to?(:source_location)
|
|
35
41
|
if group.is_a? Class
|
|
36
|
-
suite = group.public_instance_methods.select { |mtd| mtd.to_s.match
|
|
42
|
+
suite = group.public_instance_methods.select { |mtd| mtd.to_s.match(/^test_/) }
|
|
37
43
|
name = suite.find { |mtd| mtd.to_s == example }
|
|
38
44
|
group.instance_method(name).source_location
|
|
39
45
|
else
|
|
40
|
-
suite = group.methods.select { |mtd| mtd.to_s.match
|
|
46
|
+
suite = group.methods.select { |mtd| mtd.to_s.match(/^test_/) }
|
|
41
47
|
name = suite.find { |mtd| mtd.to_s == group.name }
|
|
42
48
|
group.method(name).source_location
|
|
43
49
|
end
|
|
44
50
|
end
|
|
45
51
|
|
|
46
52
|
def location_with_line_number(group, example = nil)
|
|
47
|
-
File.expand_path(location(group, example).join(
|
|
53
|
+
File.expand_path(location(group, example).join(":")).gsub(Dir.getwd, ".")
|
|
48
54
|
end
|
|
49
55
|
|
|
50
56
|
def location_without_line_number(group, example = nil)
|
|
51
|
-
File.expand_path(location(group, example).first).gsub(Dir.getwd,
|
|
57
|
+
File.expand_path(location(group, example).first).gsub(Dir.getwd, ".")
|
|
52
58
|
end
|
|
53
59
|
|
|
54
60
|
def inject_to_minitest_reporters
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require "test_prof/event_prof/minitest"
|
|
4
|
+
require "test_prof/factory_doctor/minitest"
|
|
5
5
|
|
|
6
6
|
module Minitest # :nodoc:
|
|
7
7
|
module TestProf # :nodoc:
|
|
8
8
|
def self.configure_options(options = {})
|
|
9
9
|
options.tap do |opts|
|
|
10
|
-
opts[:event] = ENV[
|
|
11
|
-
opts[:rank_by] = ENV[
|
|
12
|
-
opts[:top_count] = ENV[
|
|
13
|
-
opts[:per_example] = true if ENV[
|
|
14
|
-
opts[:fdoc] = true if ENV[
|
|
10
|
+
opts[:event] = ENV["EVENT_PROF"] if ENV["EVENT_PROF"]
|
|
11
|
+
opts[:rank_by] = ENV["EVENT_PROF_RANK"].to_sym if ENV["EVENT_PROF_RANK"]
|
|
12
|
+
opts[:top_count] = ENV["EVENT_PROF_TOP"].to_i if ENV["EVENT_PROF_TOP"]
|
|
13
|
+
opts[:per_example] = true if ENV["EVENT_PROF_EXAMPLES"]
|
|
14
|
+
opts[:fdoc] = true if ENV["FDOC"]
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -29,7 +29,7 @@ module Minitest # :nodoc:
|
|
|
29
29
|
opts.on "--event-prof-per-example", TrueClass, "Includes examples metrics to results" do |flag|
|
|
30
30
|
options[:per_example] = flag
|
|
31
31
|
end
|
|
32
|
-
opts.on "--factory-doctor", TrueClass,
|
|
32
|
+
opts.on "--factory-doctor", TrueClass, "Enable Factory Doctor for your examples" do |flag|
|
|
33
33
|
options[:fdoc] = flag
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -27,7 +27,7 @@ module TestProf
|
|
|
27
27
|
|
|
28
28
|
ts = TestProf.now
|
|
29
29
|
store[key] = yield
|
|
30
|
-
stats[key] = {
|
|
30
|
+
stats[key] = {time: TestProf.now - ts, hit: 0}
|
|
31
31
|
store[key]
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -91,7 +91,7 @@ module TestProf
|
|
|
91
91
|
|
|
92
92
|
msgs << format(
|
|
93
93
|
"%#{first_column}s %12s %9s %12s",
|
|
94
|
-
|
|
94
|
+
"key", "build time", "hit count", "saved time"
|
|
95
95
|
)
|
|
96
96
|
|
|
97
97
|
msgs << ""
|
|
@@ -144,6 +144,6 @@ module TestProf
|
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
-
self.reporting_enabled = ENV[
|
|
147
|
+
self.reporting_enabled = ENV["ANYFIXTURE_REPORT"] == "1"
|
|
148
148
|
end
|
|
149
149
|
end
|
|
@@ -26,5 +26,16 @@ module TestProf
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
configure do |config|
|
|
31
|
+
# Make sure ActiveRecord uses locked thread.
|
|
32
|
+
# It only gets locked in `before` / `setup` hook,
|
|
33
|
+
# thus using thread in `before_all` (e.g. ActiveJob async adapter)
|
|
34
|
+
# might lead to leaking connections
|
|
35
|
+
config.before(:begin) do
|
|
36
|
+
next unless ::ActiveRecord::Base.connection.pool.respond_to?(:lock_thread=)
|
|
37
|
+
::ActiveRecord::Base.connection.pool.lock_thread = true
|
|
38
|
+
end
|
|
39
|
+
end
|
|
29
40
|
end
|
|
30
41
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TestProf
|
|
4
|
+
module BeforeAll
|
|
5
|
+
# Disable Isolator within before_all blocks
|
|
6
|
+
module Isolator
|
|
7
|
+
def begin_transaction(*)
|
|
8
|
+
::Isolator.disable { super }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def within_transaction(*)
|
|
12
|
+
::Isolator.disable { super }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
TestProf::BeforeAll.singleton_class.prepend(TestProf::BeforeAll::Isolator)
|