tldr 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b1d2d2176a02f16901ea2c2c739fd576c46fd363e5ea79790718f58efadedba
4
- data.tar.gz: 727de7ca74f16a4676636780e19abc1f7c9cd0d906b4577de1aa462039f6e8f5
3
+ metadata.gz: dff20d2ad060e8ac1b1219978e871b9dc06014186429371dd2de8e929c092b78
4
+ data.tar.gz: 5922e6fb5053898d5ff70162d9d542f759332db59f29cfbd89ab4aadfb7d5623
5
5
  SHA512:
6
- metadata.gz: ca384136a4c9c1863f4f22916090f8c4f6f1836f3935495d0c0018d7fee48237c1ce9797ecc7e35739a14890893aa32a85b2159ceecc501959729f8bc2071543
7
- data.tar.gz: 8580d4cf390cc8f15515e45f7354007bd3419bbbed0749ec9d0b574d52f96de4d8a8ec3966480d96a6c2e853a520964cb8e671b371407070d78d414f4c74c2a3
6
+ metadata.gz: 46165b260ba40d54acbc986258c9a7f94377960f05acaec34bba27b6dc16cde89a19884393b008d751f64c413d54c445a39202c493293f106fd7a2cbd32f06fa
7
+ data.tar.gz: 60785c5e4bb01cc804636c770b299e1c08b1f97165a1459a17e8de59a178df2267e04e9ffb9a98e95aa9fc698aeb26139094b79b20c035d72a6ffa7780d89aa7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0]
4
+
5
+ - Add a rake task "tldr"
6
+ ## [0.1.1]
7
+
8
+ - Improve Minitest compatibility by mixing in Assertions#capture_io
9
+ - Fix whitespace in reporter
10
+
3
11
  ## [0.1.0]
4
12
 
5
13
  - Initial release
data/README.md CHANGED
@@ -203,6 +203,28 @@ with these caveats:
203
203
  TLDR::Assertions::MinitestCompatibility` into the `TLDR` base class or
204
204
  individual test classes
205
205
 
206
+ ### Running TLDR with Rake
207
+
208
+ TLDR ships with a [very](lib/tldr/rake.rb) minimal rake task that simply shells
209
+ out to the `tldr` CLI. If you want to run TLDR with Rake, you can configure
210
+ the test run by setting flags on an env var named `TLDR_OPTS` or else in
211
+ the [.tldr.yml](#setting-defaults-in-tldryml).
212
+
213
+ Here's an example Rakefile:
214
+
215
+ ```ruby
216
+ require "standard/rake"
217
+ require "tldr/rake"
218
+
219
+ task default: [:tldr, "standard:fix"]
220
+ ```
221
+
222
+ You could then run the task with:
223
+
224
+ ```
225
+ $ TLDR_OPTS="--no-parallel" bundle exec rake tldr
226
+ ```
227
+
206
228
  ### How will I run all my tests in CI without the time bomb going off?
207
229
 
208
230
  TLDR will run all your tests in CI without the time bomb going off.
@@ -28,7 +28,7 @@ class TLDR
28
28
  SuperDiff::EqualityMatchers::Main.call(expected:, actual:)
29
29
  end
30
30
 
31
- def self.capture_io
31
+ def capture_io
32
32
  captured_stdout, captured_stderr = StringIO.new, StringIO.new
33
33
 
34
34
  original_stdout, original_stderr = $stdout, $stderr
@@ -204,7 +204,7 @@ class TLDR
204
204
  def assert_output expected_stdout, expected_stderr, message = nil, &block
205
205
  assert_block "assert_output requires a block to capture output" unless block
206
206
 
207
- actual_stdout, actual_stderr = Assertions.capture_io(&block)
207
+ actual_stdout, actual_stderr = capture_io(&block)
208
208
 
209
209
  if Regexp === expected_stderr
210
210
  assert_match expected_stderr, actual_stderr, "In stderr"
@@ -1,8 +1,6 @@
1
1
  class TLDR
2
2
  class BacktraceFilter
3
3
  BASE_PATH = __dir__.freeze
4
- SORBET_RUNTIME_PATTERN = %r{sorbet-runtime.*[/\\]lib[/\\]types[/\\]private[/\\]}
5
- CONCURRENT_RUBY_PATTERN = %r{concurrent-ruby.*[/\\]lib[/\\]concurrent-ruby[/\\]concurrent[/\\]}
6
4
 
7
5
  def filter backtrace
8
6
  return ["No backtrace"] unless backtrace
@@ -32,9 +30,7 @@ class TLDR
32
30
  end
33
31
 
34
32
  def internal? frame
35
- frame.start_with?(BASE_PATH) ||
36
- frame.match?(SORBET_RUNTIME_PATTERN) ||
37
- frame.match?(CONCURRENT_RUBY_PATTERN)
33
+ frame.start_with?(BASE_PATH)
38
34
  end
39
35
  end
40
36
 
data/lib/tldr/rake.rb ADDED
@@ -0,0 +1,4 @@
1
+ desc "Run tests with TLDR (use TLDR_OPTS or .tldr.yml to configure)"
2
+ task :tldr do
3
+ fail unless system "#{"bundle exec " if defined?(Bundler)}tldr #{ENV["TLDR_OPTS"]}"
4
+ end
@@ -73,10 +73,8 @@ class TLDR
73
73
  duration = time_diff @suite_start_time
74
74
  test_results = test_results.sort_by { |result| [result.test.location.file, result.test.location.line] }
75
75
 
76
- @out.print "\n\n"
77
76
  @err.print summarize_failures(test_results).join("\n\n")
78
77
 
79
- @out.print "\n\n"
80
78
  @out.print summarize_skips(test_results).join("\n")
81
79
 
82
80
  @out.print "\n\n"
@@ -102,7 +100,7 @@ class TLDR
102
100
  failures = results.select { |result| result.failing? }
103
101
  return failures if failures.empty?
104
102
 
105
- ["Failing tests:"] + failures.map.with_index { |result, i| summarize_result result, i }
103
+ ["\n\nFailing tests:"] + failures.map.with_index { |result, i| summarize_result result, i }
106
104
  end
107
105
 
108
106
  def summarize_result result, index
@@ -119,7 +117,7 @@ class TLDR
119
117
  skips = results.select { |result| result.skip? }
120
118
  return skips if skips.empty?
121
119
 
122
- ["Skipped tests:\n"] + skips.map { |result| " - #{describe(result.test)}" }
120
+ ["\n\nSkipped tests:\n"] + skips.map { |result| " - #{describe(result.test)}" }
123
121
  end
124
122
 
125
123
  def describe test, location = test.location
data/lib/tldr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class TLDR
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/script/setup ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ bundle
6
+
7
+ cd example/a
8
+ bundle
9
+ cd ../..
10
+
11
+ cd example/b
12
+ bundle
13
+ cd ../..
14
+
15
+ cd example/c
16
+ bundle
17
+ cd ../..
18
+
19
+ cd example/d
20
+ bundle
21
+ cd ../..
data/script/test CHANGED
@@ -1,25 +1,14 @@
1
- #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
1
+ #!/usr/bin/env bash
3
2
 
4
- require "tldr"
3
+ set -e
5
4
 
6
- class FunTest < TLDR
7
- def test_passes
8
- assert true
9
- end
5
+ bundle exec rake
10
6
 
11
- def test_false
12
- assert false
13
- end
7
+ cd example/a
8
+ bundle exec tldr | grep "😁😁"
9
+ cd ../..
14
10
 
15
- def test_hello
16
- raise "💥"
17
- end
18
-
19
- def test_slow
20
- skip
21
- sleep 2
22
- end
23
- end
24
-
25
- TLDR::Run.run(TLDR::Config.new(paths: []))
11
+ cd example/b
12
+ bundle exec ruby -Itest test/some_test.rb | grep "😁"
13
+ bundle exec rake tldr | grep "😁"
14
+ cd ../..
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.1.0
4
+ version: 0.2.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-09-25 00:00:00.000000000 Z
12
+ date: 2023-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: super_diff
@@ -61,6 +61,7 @@ files:
61
61
  - lib/tldr/backtrace_filter.rb
62
62
  - lib/tldr/error.rb
63
63
  - lib/tldr/planner.rb
64
+ - lib/tldr/rake.rb
64
65
  - lib/tldr/reporters.rb
65
66
  - lib/tldr/reporters/base.rb
66
67
  - lib/tldr/reporters/default.rb
@@ -76,8 +77,7 @@ files:
76
77
  - lib/tldr/value/test_result.rb
77
78
  - lib/tldr/value/wip_test.rb
78
79
  - lib/tldr/version.rb
79
- - script/parse
80
- - script/run
80
+ - script/setup
81
81
  - script/test
82
82
  homepage: https://github.com/tenderlove/tldr
83
83
  licenses:
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.4.6
104
+ rubygems_version: 3.4.17
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: TLDR will run your tests, but only for 1.8 seconds.
data/script/parse DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
3
-
4
- require "tldr"
5
-
6
- pp TLDR::ArgvParser.new.parse(ARGV).to_h
data/script/run DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
3
-
4
- require "tldr"
5
-
6
- TLDR::Run.cli(ARGV)