tldr 0.7.0 → 0.8.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 +5 -0
- data/README.md +16 -1
- data/lib/tldr/argv_parser.rb +5 -1
- data/lib/tldr/reporters/default.rb +26 -20
- data/lib/tldr/value/config.rb +5 -3
- data/lib/tldr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81e3d6734a718c5abbf80cfb088369d5a6bb89b81fc261020d97e34cbd6903bb
|
4
|
+
data.tar.gz: 1c4d0b5a53a948d868556b027f6fd6cdb4b9a96e67b459f0b2bf73e05a251d2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df9de67f0609adc2c5e0d2fc44a3bec44dd8a25a4ed0d128b8f1beaad6f45343dc9e5644e8d3b94b5bbe4db919f3becdf2e9a468a6eda0978669018135993d1f
|
7
|
+
data.tar.gz: 00e813b4947ef3d9e267e3ea4248def3254829b4b910719ad4cdd258cf809d751d7c5a539d527a708f9ff3471fe45fe24fc342d132f15948a56d7d5a56b38c7e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -123,7 +123,8 @@ Usage: tldr [options] some_tests/**/*.rb some/path.rb:13 ...
|
|
123
123
|
--no-emoji Disable emoji in the output
|
124
124
|
-v, --verbose Print stack traces for errors
|
125
125
|
--[no-]warnings Print Ruby warnings (Default: true)
|
126
|
-
--
|
126
|
+
--yes-i-know Suppress TLDR report when suite runs over 1.8s
|
127
|
+
--comment COMMENT No-op; used for multi-line execution instructions
|
127
128
|
```
|
128
129
|
|
129
130
|
After being parsed, all the CLI options are converted into a
|
@@ -336,12 +337,26 @@ with the `--reporter` command line option. It can be set to any fully-qualified
|
|
336
337
|
class name that extends from
|
337
338
|
[TLDR::Reporters::Base](/lib/tldr/reporters/base.rb).
|
338
339
|
|
340
|
+
### I know my tests are over 1.8s, how do I suppress the huge output?
|
341
|
+
|
342
|
+
Plenty of test suites are over 1.8s and having TLDR repeatedly print out the
|
343
|
+
huge summary at the end of each test run can be distracting and make it harder
|
344
|
+
to spot test failures. If you know your test suite is too slow, you can simply
|
345
|
+
add the `--yes-i-know` flag
|
346
|
+
|
339
347
|
### What about mocking?
|
340
348
|
|
341
349
|
TLDR is laser-focused on running tests, so it doesn't provide a built-in mocking
|
342
350
|
facility. Might we interest you in a refreshing
|
343
351
|
[mocktail](https://github.com/testdouble/mocktail), instead?
|
344
352
|
|
353
|
+
### Contributing to TLDR
|
354
|
+
|
355
|
+
If you want to submit PRs on this repo, please know that the code style is
|
356
|
+
[Kirkland-style Ruby](https://mastodon.social/@searls/111137666157318482), where
|
357
|
+
method definitions have parentheses omitted but parentheses are generally
|
358
|
+
expected for method invocations.
|
359
|
+
|
345
360
|
## Acknowledgements
|
346
361
|
|
347
362
|
Thanks to [George Sheppard](https://github.com/fuzzmonkey) for freeing up the
|
data/lib/tldr/argv_parser.rb
CHANGED
@@ -82,7 +82,11 @@ class TLDR
|
|
82
82
|
options[:warnings] = warnings
|
83
83
|
end
|
84
84
|
|
85
|
-
opts.on
|
85
|
+
opts.on CONFLAGS[:yes_i_know], "Suppress TLDR report when suite runs over 1.8s" do
|
86
|
+
options[:yes_i_know] = true
|
87
|
+
end
|
88
|
+
|
89
|
+
opts.on "--comment COMMENT", String, "No-op; used for multi-line execution instructions" do
|
86
90
|
# See "--comment" in lib/tldr/reporters/default.rb for an example of how this is used internally
|
87
91
|
end
|
88
92
|
end.parse!(args)
|
@@ -31,29 +31,31 @@ class TLDR
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
def time_diff start, stop = Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond)
|
35
|
-
((stop - start) / 1000.0).round
|
36
|
-
end
|
37
|
-
|
38
34
|
def after_tldr planned_tests, wip_tests, test_results
|
39
35
|
stop_time = Process.clock_gettime Process::CLOCK_MONOTONIC, :microsecond
|
40
36
|
|
41
37
|
@out.print @icons.tldr
|
42
38
|
@err.print "\n\n"
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
39
|
+
|
40
|
+
if @config.yes_i_know
|
41
|
+
@err.print "🚨 TLDR! Display summary by omitting --yes-i-know"
|
42
|
+
else
|
43
|
+
wrap_in_horizontal_rule do
|
44
|
+
@err.print [
|
45
|
+
"too long; didn't run!",
|
46
|
+
"#{@icons.run} Completed #{test_results.size} of #{planned_tests.size} tests (#{((test_results.size.to_f / planned_tests.size) * 100).round}%) before running out of time.",
|
47
|
+
(<<~WIP.chomp if wip_tests.any?),
|
48
|
+
#{@icons.wip} #{plural wip_tests.size, "test was", "tests were"} cancelled in progress:
|
49
|
+
#{wip_tests.map { |wip_test| " #{time_diff(wip_test.start_time, stop_time)}ms - #{describe(wip_test.test)}" }.join("\n")}
|
50
|
+
WIP
|
51
|
+
(<<~SLOW.chomp if test_results.any?),
|
52
|
+
#{@icons.slow} Your #{[10, test_results.size].min} slowest completed tests:
|
53
|
+
#{test_results.sort_by(&:runtime).last(10).reverse.map { |result| " #{result.runtime}ms - #{describe(result.test)}" }.join("\n")}
|
54
|
+
SLOW
|
55
|
+
describe_tests_that_didnt_finish(planned_tests, test_results),
|
56
|
+
"🙈 Suppress this summary with --yes-i-know"
|
57
|
+
].compact.join("\n\n")
|
58
|
+
end
|
57
59
|
end
|
58
60
|
|
59
61
|
after_suite test_results
|
@@ -102,6 +104,10 @@ class TLDR
|
|
102
104
|
|
103
105
|
private
|
104
106
|
|
107
|
+
def time_diff start, stop = Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond)
|
108
|
+
((stop - start) / 1000.0).round
|
109
|
+
end
|
110
|
+
|
105
111
|
def summarize_failures results
|
106
112
|
failures = results.select { |result| result.failing? }
|
107
113
|
return failures if failures.empty?
|
@@ -138,7 +144,7 @@ class TLDR
|
|
138
144
|
rule = @icons.alarm + "=" * 20 + " ABORTED RUN " + "=" * 20 + @icons.alarm
|
139
145
|
@err.print "#{rule}\n\n"
|
140
146
|
yield
|
141
|
-
@err.print "\n\n#{rule}
|
147
|
+
@err.print "\n\n#{rule}"
|
142
148
|
end
|
143
149
|
|
144
150
|
def describe_tests_that_didnt_finish planned_tests, test_results
|
@@ -150,7 +156,7 @@ class TLDR
|
|
150
156
|
failed_locators = consolidate failed, exclude: unrun_locators
|
151
157
|
suggested_locators = unrun_locators + [
|
152
158
|
("--comment \"Also include #{plural failed.size, "test"} that failed:\"" if failed_locators.any?)
|
153
|
-
] + failed_locators
|
159
|
+
].compact + failed_locators
|
154
160
|
<<~MSG
|
155
161
|
#{@icons.rock_on} Run the #{plural unrun.size, "test"} that didn't finish:
|
156
162
|
#{tldr_command} #{@config.to_full_args exclude: [:paths]} #{suggested_locators.join(" \\\n ")}
|
data/lib/tldr/value/config.rb
CHANGED
@@ -17,6 +17,7 @@ class TLDR
|
|
17
17
|
base_path: "--base-path",
|
18
18
|
no_dotfile: "--no-dotfile",
|
19
19
|
warnings: "--[no-]warnings",
|
20
|
+
yes_i_know: "--yes-i-know",
|
20
21
|
paths: nil
|
21
22
|
}.freeze
|
22
23
|
|
@@ -26,7 +27,7 @@ class TLDR
|
|
26
27
|
:paths, :seed, :no_helper, :verbose, :reporter,
|
27
28
|
:helper_paths, :load_paths, :parallel, :names, :fail_fast, :no_emoji,
|
28
29
|
:prepend_paths, :no_prepend, :exclude_paths, :exclude_names, :base_path,
|
29
|
-
:no_dotfile, :warnings,
|
30
|
+
:no_dotfile, :warnings, :yes_i_know,
|
30
31
|
# Internal properties
|
31
32
|
:config_intended_for_merge_only, :seed_set_intentionally, :cli_defaults
|
32
33
|
].freeze
|
@@ -64,7 +65,8 @@ class TLDR
|
|
64
65
|
exclude_paths: [],
|
65
66
|
exclude_names: [],
|
66
67
|
base_path: nil,
|
67
|
-
warnings: true
|
68
|
+
warnings: true,
|
69
|
+
yes_i_know: false
|
68
70
|
}
|
69
71
|
|
70
72
|
if cli_defaults
|
@@ -101,7 +103,7 @@ class TLDR
|
|
101
103
|
end
|
102
104
|
|
103
105
|
# Booleans
|
104
|
-
[:no_helper, :verbose, :fail_fast, :no_emoji, :no_prepend, :warnings].each do |key|
|
106
|
+
[:no_helper, :verbose, :fail_fast, :no_emoji, :no_prepend, :warnings, :yes_i_know].each do |key|
|
105
107
|
merged_args[key] = defaults[key] if merged_args[key].nil?
|
106
108
|
end
|
107
109
|
|
data/lib/tldr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tldr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-10-
|
12
|
+
date: 2023-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: super_diff
|