test-prof 0.4.9 → 0.5.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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +106 -20
  3. data/README.md +10 -57
  4. data/assets/tagprof.demo.html +447 -0
  5. data/assets/tagprof.template.html +447 -0
  6. data/lib/minitest/event_prof_formatter.rb +18 -16
  7. data/lib/test_prof/any_fixture/dsl.rb +18 -0
  8. data/lib/test_prof/any_fixture.rb +92 -8
  9. data/lib/test_prof/event_prof/custom_events/factory_create.rb +1 -1
  10. data/lib/test_prof/event_prof/custom_events/sidekiq_inline.rb +1 -1
  11. data/lib/test_prof/event_prof/custom_events/sidekiq_jobs.rb +1 -1
  12. data/lib/test_prof/event_prof/custom_events.rb +30 -0
  13. data/lib/test_prof/event_prof/minitest.rb +6 -0
  14. data/lib/test_prof/event_prof/profiler.rb +129 -0
  15. data/lib/test_prof/event_prof/rspec.rb +20 -11
  16. data/lib/test_prof/event_prof.rb +10 -108
  17. data/lib/test_prof/ext/active_record_refind.rb +20 -0
  18. data/lib/test_prof/factory_all_stub/factory_bot_patch.rb +13 -0
  19. data/lib/test_prof/factory_all_stub.rb +32 -0
  20. data/lib/test_prof/factory_doctor/rspec.rb +3 -2
  21. data/lib/test_prof/factory_prof/printers/flamegraph.rb +9 -13
  22. data/lib/test_prof/recipes/active_record_one_love.rb +4 -0
  23. data/lib/test_prof/recipes/active_record_shared_connection.rb +55 -0
  24. data/lib/test_prof/recipes/logging.rb +37 -0
  25. data/lib/test_prof/recipes/rspec/any_fixture.rb +4 -1
  26. data/lib/test_prof/recipes/rspec/factory_all_stub.rb +10 -0
  27. data/lib/test_prof/rspec_dissect/rspec.rb +4 -2
  28. data/lib/test_prof/rspec_stamp/rspec.rb +3 -2
  29. data/lib/test_prof/tag_prof/printers/html.rb +24 -0
  30. data/lib/test_prof/tag_prof/printers/simple.rb +82 -0
  31. data/lib/test_prof/tag_prof/result.rb +38 -0
  32. data/lib/test_prof/tag_prof/rspec.rb +43 -40
  33. data/lib/test_prof/tag_prof.rb +4 -0
  34. data/lib/test_prof/utils/html_builder.rb +21 -0
  35. data/lib/test_prof/version.rb +1 -1
  36. data/lib/test_prof.rb +2 -1
  37. metadata +20 -22
  38. data/assets/logo.svg +0 -1
  39. data/assets/testprof.png +0 -0
  40. data/guides/.rubocop.yml +0 -1
  41. data/guides/any_fixture.md +0 -114
  42. data/guides/before_all.md +0 -98
  43. data/guides/event_prof.md +0 -177
  44. data/guides/factory_default.md +0 -111
  45. data/guides/factory_doctor.md +0 -119
  46. data/guides/factory_prof.md +0 -86
  47. data/guides/let_it_be.md +0 -97
  48. data/guides/rspec_dissect.md +0 -60
  49. data/guides/rspec_stamp.md +0 -52
  50. data/guides/rubocop.md +0 -48
  51. data/guides/ruby_prof.md +0 -63
  52. data/guides/stack_prof.md +0 -47
  53. data/guides/tag_prof.md +0 -51
  54. data/guides/tests_sampling.md +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34e45def589431c2dd53ec256e009877c9a611ad1fa1cd7799cf6ec75c15745c
4
- data.tar.gz: 2230613ed9c7e5bf9733a16824f7e61daa77ed524b846de4195168e89a8b5d0e
3
+ metadata.gz: bc2f073e4331955ed514e20849bb5dadf28d4f5934254ae3d30ca2c60db90ff0
4
+ data.tar.gz: d07ba0a976611946258de85284b697d0ccf7adbdeaae0363efebd868156100e4
5
5
  SHA512:
6
- metadata.gz: 176beb48fdd32511a3516bcd28392cc9b9677b7cc6b1946c25f83111eeb1c0b4602387913bda61a9524c7211d044c1c16cf47d6a48fbadf803145e660d7e03ff
7
- data.tar.gz: ed688acfb83aae1e7906c01daf363f676d72109cb3f29cfb04923288fba3b0af89c1d72d1e544d7887a940bee2fde79b7f5bb35a4a364a88fa728e3f178e77f4
6
+ metadata.gz: c942589dbd72c954f54a4cb874d91f98a2c9a64c604fb82b32476bcf2ea9b82fbfa72222e32b0cfec52fc1b335b2c9e69d99567be21e91b8084005a94ed9963a
7
+ data.tar.gz: e90718e07df7b566c657c9192805a4a1f523196578699f7cbc93f3cf25ddf09634bcb0bda35e5e18a9f1501708e583748df4575b721c20886605ca1c863efff6
data/CHANGELOG.md CHANGED
@@ -2,7 +2,93 @@
2
2
 
3
3
  ## master
4
4
 
5
- ## 0.4.9
5
+ ## 0.5.0 (2018-04-25)
6
+
7
+ ### Features
8
+
9
+ - Add events support to TagProf. ([@palkan][])
10
+
11
+ Example usage:
12
+
13
+ ```sh
14
+ TAG_PROF=type TAG_PROF_EVENT=sql.active_record rspec
15
+ ```
16
+
17
+ [📝 Docs](https://test-prof.evilmartians.io/#/tag_prof?id=profiling-events)
18
+
19
+ - Add logging helpers for Rails. ([@palkan][])
20
+
21
+ Enalbe verbose logging globally:
22
+
23
+ ```sh
24
+ LOG=all rspec
25
+ ```
26
+
27
+ Or per example (group):
28
+
29
+ ```ruby
30
+ it 'does smth weird', :log do
31
+ # ...
32
+ end
33
+ ```
34
+
35
+ [📝 Docs](https://test-prof.evilmartians.io/#/logging)
36
+
37
+ - Add HTML report for `TagProf`. ([@palkan][])
38
+
39
+ Generate HTML report by setting `TAG_PROF_FORMAT` to `html`.
40
+
41
+ - Add ability to track multiple events at the same time with `EventProf`. ([@palkan][])
42
+
43
+ - Add `AnyFixture` DSL. ([@palkan][])
44
+
45
+ Example:
46
+
47
+ ```ruby
48
+ # Enable DSL
49
+ using TestProf::AnyFixture::DSL
50
+
51
+ # and then you can use `fixture` method (which is just an alias for `TestProf::AnyFixture.register`)
52
+ before(:all) { fixture(:account) }
53
+
54
+ # You can also use it to fetch the record (instead of storing it in instance variable)
55
+ let(:account) { fixture(:account) }
56
+ ```
57
+
58
+ [📝 Docs](https://test-prof.evilmartians.io/#/any_fixture?id=dsl)
59
+
60
+ - Add `AnyFixture` usage report. ([@palkan][])
61
+
62
+ Enable `AnyFixture` usage reporting with `ANYFIXTURE_REPORTING=1` or with:
63
+
64
+ ```ruby
65
+ TestProf::AnyFixture.reporting_enabled = true
66
+ ```
67
+
68
+ [📝 Docs](https://test-prof.evilmartians.io/#/any_fixture?id=usage-report)
69
+
70
+ - Add `ActiveRecordSharedConnection` recipe. ([@palkan][])
71
+
72
+ Force ActiveRecord to use the same connection between threads (to avoid database cleaning in browser tests).
73
+
74
+ [📝 Docs](https://test-prof.evilmartians.io/#/active_record_shared_connection)
75
+
76
+ - [#70](https://github.com/palkan/test-prof/pull/70) Add `FactoryAllStub` recipe. ([@palkan][])
77
+
78
+ [📝 Docs](https://test-prof.evilmartians.io/#/factory_all_stub)
79
+
80
+ - Add `ActiveRecordRefind` refinement. ([@palkan][])
81
+
82
+ [📝 Docs](https://test-prof.evilmartians.io/#/any_fixture?id=activerecordrefind)
83
+
84
+ ### Fixes & Improvements
85
+
86
+ - **Brand new documentatation website: https://test-prof.evilmartians.io/**
87
+
88
+ - Disable referential integrity when cleaning AnyFixture. ([@palkan][])
89
+
90
+
91
+ ## 0.4.9 (2018-03-20)
6
92
 
7
93
  - [Fix [#64](https://github.com/palkan/test-prof/issues/64)] Fix dependencies requiring for FactoryDefault. ([@palkan][])
8
94
 
@@ -11,7 +97,7 @@
11
97
  Consider only `example_failed` and `example_passed` to ensure that the `run_time`
12
98
  is available.
13
99
 
14
- ## 0.4.8
100
+ ## 0.4.8 (2018-01-17)
15
101
 
16
102
  - Add `minitest` 5.11 support. ([@palkan][])
17
103
 
@@ -24,36 +110,36 @@
24
110
 
25
111
  Possibly fixes [#47](https://github.com/palkan/test-prof/issues/47).
26
112
 
27
- ## 0.4.7
113
+ ## 0.4.7 (2017-12-25)
28
114
 
29
115
  - [#57](https://github.com/palkan/test-prof/pull/57) Fix RubyProf Printers Support ([@rabotyaga][])
30
116
 
31
- ## 0.4.6
117
+ ## 0.4.6 (2017-12-17)
32
118
 
33
119
  - Upgrade RSpec/AggregateFailures to RuboCop 0.52.0. ([@palkan][])
34
120
 
35
121
  RuboCop < 0.51.0 is not supported anymore.
36
122
 
37
- - [Fixes [#49](https://github.com/palkan/test-prof/issues/49)] Correcly detect RSpec version in `let_it_be`. ([@desoleary][])
123
+ - [Fixes [#49](https://github.com/palkan/test-prof/issues/49)] Correctly detect RSpec version in `let_it_be`. ([@desoleary][])
38
124
 
39
- ## 0.4.5
125
+ ## 0.4.5 (2017-12-09)
40
126
 
41
127
  - Fix circular require in `lib/factory_doctor/minitest`. ([@palkan][])
42
128
 
43
- ## 0.4.4
129
+ ## 0.4.4 (2017-11-08)
44
130
 
45
131
  - [Fixes [#48](https://github.com/palkan/test-prof/issues/48)] Respect RubyProf reports files extensions. ([@palkan][])
46
132
 
47
- ## 0.4.3
133
+ ## 0.4.3 (2017-10-26)
48
134
 
49
135
  - [#46](https://github.com/palkan/test-prof/pull/46) Support FactoryBot, which is [former FactoryGirl](https://github.com/thoughtbot/factory_bot/pull/1051),
50
136
  while maintaining compatibility with latter. ([@Shkrt][])
51
137
 
52
- ## 0.4.2
138
+ ## 0.4.2 (2017-10-23)
53
139
 
54
140
  - Fix bug with multiple `before_all` within one group. ([@palkan][])
55
141
 
56
- ## 0.4.1
142
+ ## 0.4.1 (2017-10-18)
57
143
 
58
144
  - [#44](https://github.com/palkan/test-prof/pull/44) Support older versions of RSpec. ([@palkan][])
59
145
 
@@ -67,7 +153,7 @@ RSpecDissect `let` tracking supports only RSpec 3.3.0+.
67
153
 
68
154
  It is possible now to use Factory Doctor with Minitest
69
155
 
70
- ## 0.4.0
156
+ ## 0.4.0 (2017-10-03)
71
157
 
72
158
  ### Features:
73
159
 
@@ -79,7 +165,7 @@ It is possible now to use Event Prof with Minitest
79
165
 
80
166
  FactoryProf now also accounts objects created by Fabrication gem (in addition to FactoryGirl)
81
167
 
82
- ## 0.3.0
168
+ ## 0.3.0 (2017-09-21)
83
169
 
84
170
  ### Features:
85
171
 
@@ -116,21 +202,21 @@ Just like `let`, but persist the result for the whole group (i.e. `let` + `befor
116
202
 
117
203
  - Use RubyProf `FlatPrinter` by default (was `CallStackPrinter`). ([@palkan][])
118
204
 
119
- ## 0.2.5
205
+ ## 0.2.5 (2017-08-30)
120
206
 
121
207
  - [#16](https://github.com/palkan/test-prof/pull/16) Support Ruby >= 2.2.0 (was >= 2.3.0). ([@palkan][])
122
208
 
123
- ## 0.2.4
209
+ ## 0.2.4 (2017-08-29)
124
210
 
125
211
  - EventProf: Fix regression bug with examples profiling. ([@palkan][])
126
212
 
127
213
  There was a bug when an event occurs before the example has started (e.g. in `before(:context)` hook).
128
214
 
129
- ## 0.2.3
215
+ ## 0.2.3 (2017-08-28)
130
216
 
131
217
  - Minor improvements. ([@palkan][])
132
218
 
133
- ## 0.2.2
219
+ ## 0.2.2 (2017-08-23)
134
220
 
135
221
  - Fix time calculation when Time class is monkey-patched. ([@palkan][])
136
222
 
@@ -139,13 +225,13 @@ use it everywhere.
139
225
 
140
226
  Fixes [#10](https://github.com/palkan/test-prof/issues/10).
141
227
 
142
- ## 0.2.1
228
+ ## 0.2.1 (2017-08-19)
143
229
 
144
230
  - Detect `RSpec` by checking the presence of `RSpec::Core`. ([@palkan][])
145
231
 
146
232
  Fixes [#8](https://github.com/palkan/test-prof/issues/8).
147
233
 
148
- ## 0.2.0
234
+ ## 0.2.0 (2017-08-18)
149
235
 
150
236
  - Ensure output directory exists. ([@danielwestendorf][])
151
237
 
@@ -157,11 +243,11 @@ Ensure output dir exists in `#artifact_path` method.
157
243
 
158
244
  - FactoryDoctor: print success message when no bad examples found. ([@palkan][])
159
245
 
160
- ## 0.1.1
246
+ ## 0.1.1 (2017-08-17)
161
247
 
162
248
  - AnyFixture: clean tables in reverse order to not fail when foreign keys exist. ([@marshall-lee][])
163
249
 
164
- ## 0.1.0
250
+ ## 0.1.0 (2017-08-15)
165
251
 
166
252
  - Initial version. ([@palkan][])
167
253
 
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
- [![Gem Version](https://badge.fury.io/rb/test-prof.svg)](https://rubygems.org/gems/test-prof) [![Build Status](https://travis-ci.org/palkan/test-prof.svg?branch=master)](https://travis-ci.org/palkan/test-prof) [![CircleCI](https://circleci.com/gh/palkan/test-prof.svg?style=svg)](https://circleci.com/gh/palkan/test-prof) [![Code Triagers Badge](https://www.codetriage.com/palkan/test-prof/badges/users.svg)](https://www.codetriage.com/palkan/test-prof)
1
+ [![Gem Version](https://badge.fury.io/rb/test-prof.svg)](https://rubygems.org/gems/test-prof) [![Build Status](https://travis-ci.org/palkan/test-prof.svg?branch=master)](https://travis-ci.org/palkan/test-prof) [![Code Triagers Badge](https://www.codetriage.com/palkan/test-prof/badges/users.svg)](https://www.codetriage.com/palkan/test-prof)
2
+ [![Documentation](https://img.shields.io/badge/docs-link-brightgreen.svg)](https://test-prof.evilmartians.io)
2
3
 
3
4
  # Ruby Tests Profiling Toolbox
4
5
 
5
6
  <img align="right" height="150" width="129"
6
- title="TestProf logo" src="./assets/logo.svg">
7
+ title="TestProf logo" src="./docs/assets/images/logo.svg">
7
8
 
8
9
  TestProf is a collection of different tools to analyze your test suite performance.
9
10
 
@@ -23,11 +24,11 @@ TestProf toolbox aims to help you identify bottlenecks in your test suite. It co
23
24
 
24
25
  - etc.
25
26
 
26
- Of course, we have some [solutions](#tips-and-tricks-or-recipes) for common performance issues too, bundled into the gem.
27
+ Of course, we have some [solutions](https://test-prof.evilmartians.io/#/?id=recipes) for common performance issues too, bundled into the gem.
27
28
 
28
- [![](https://s3-us-west-1.amazonaws.com/vladem/test-prof/TestProf.png)](https://coggle.it/diagram/Wa7tW-87jAAB0ExN)
29
+ [![](./docs/assets/images/coggle.png)](http://bit.ly/test-prof-map)
29
30
 
30
- See [Table of Contents](#table-of-contents) for more.
31
+ 📑 [Documentation](https://test-prof.evilmartians.io)
31
32
 
32
33
  Supported Ruby versions:
33
34
 
@@ -60,65 +61,17 @@ end
60
61
 
61
62
  And that's it)
62
63
 
63
- ## Table of Contents
64
+ ## Usage
64
65
 
65
- Checkout our guides for each specific tool:
66
-
67
- - [RubyProf Integration](https://github.com/palkan/test-prof/tree/master/guides/ruby_prof.md)
68
-
69
- - [StackProf Integration](https://github.com/palkan/test-prof/tree/master/guides/stack_prof.md)
70
-
71
- - [Event Profiler](https://github.com/palkan/test-prof/tree/master/guides/event_prof.md) (e.g. ActiveSupport notifications)
72
-
73
- - [Tag Profiler](https://github.com/palkan/test-prof/tree/master/guides/tag_prof.md)
74
-
75
- - [Factory Doctor](https://github.com/palkan/test-prof/tree/master/guides/factory_doctor.md)
76
-
77
- - [Factory Profiler](https://github.com/palkan/test-prof/tree/master/guides/factory_prof.md)
78
-
79
- - [RSpecDissect Profiler](https://github.com/palkan/test-prof/tree/master/guides/rspec_dissect.md)
80
-
81
- - [RuboCop cops](https://github.com/palkan/test-prof/tree/master/guides/rubocop.md)
82
-
83
- ## Tips and Tricks (or _Recipes_)
84
-
85
- We also want to share some small code tricks which can help you to improve your test suite performance and efficiency:
86
-
87
- - [`before_all` Hook](https://github.com/palkan/test-prof/tree/master/guides/before_all.md)
88
-
89
- - [`let_it_be` Helper](https://github.com/palkan/test-prof/tree/master/guides/let_it_be.md)
90
-
91
- - [AnyFixture](https://github.com/palkan/test-prof/tree/master/guides/any_fixture.md)
92
-
93
- - [FactoryDefault](https://github.com/palkan/test-prof/tree/master/guides/factory_default.md)
94
-
95
- - [RSpec Stamp](https://github.com/palkan/test-prof/tree/master/guides/rspec_stamp.md)
96
-
97
- - [Tests Sampling](https://github.com/palkan/test-prof/tree/master/guides/tests_sampling.md)
98
-
99
- ## Configuration
100
-
101
- TestProf global configuration is used by most of the profilers:
102
-
103
- ```ruby
104
- TestProf.configure do |config|
105
- # the directory to put artifacts (reports) in ("tmp/test_prof" by default)
106
- config.output_dir = "tmp/test_prof"
107
-
108
- # use unique filenames for reports (by simply appending current timestamp)
109
- config.timestamps = true
110
-
111
- # color output
112
- config.color = true
113
- end
114
- ```
66
+ Check out our [docs][].
115
67
 
116
68
  ## What's next?
117
69
 
118
-
119
70
  Have an idea? [Propose](https://github.com/palkan/test-prof/issues/new) a feature request!
120
71
 
121
72
 
122
73
  ## License
123
74
 
124
75
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
76
+
77
+ [docs]: https://test-prof.evilmartians.io