minitest-silence 0.1.0 → 0.2.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/.gitignore +2 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +12 -7
- data/lib/minitest/silence/version.rb +1 -1
- data/lib/minitest/silence_plugin.rb +27 -13
- 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: cbcaf249c787322e61fb0b08a3836b5aa3c2650fc7ae3df47a029bbfe55c500e
|
4
|
+
data.tar.gz: dc346dfae4ea921cd818daa92f1cec2589ddf85f6fea1a6c0c58997e19b012cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c194b97d1130cf0261cf519b563acdcc4f8a91233a40f41817f4dab73260408d31ebe1e0fe076eac2754523862522877d51600f0a55e2bf484fb2c050a612ab
|
7
|
+
data.tar.gz: b65df74f1913124c1f71d19855c09ebadf5398a3e20f4910b4eea7b638eff9f895012d669627def451f5391aaf4c1458683b604e9295f42ae603ce694440cdfa
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,31 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
minitest-silence (0.
|
4
|
+
minitest-silence (0.2.0)
|
5
5
|
minitest (~> 5.12)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
ast (2.4.
|
11
|
-
|
10
|
+
ast (2.4.1)
|
11
|
+
byebug (11.1.3)
|
12
12
|
minitest (5.14.1)
|
13
13
|
parallel (1.19.1)
|
14
14
|
parser (2.7.1.3)
|
15
15
|
ast (~> 2.4.0)
|
16
16
|
rainbow (3.0.0)
|
17
17
|
rake (12.3.3)
|
18
|
+
regexp_parser (1.7.1)
|
18
19
|
rexml (3.2.4)
|
19
|
-
rubocop (0.
|
20
|
-
jaro_winkler (~> 1.5.1)
|
20
|
+
rubocop (0.85.1)
|
21
21
|
parallel (~> 1.10)
|
22
22
|
parser (>= 2.7.0.1)
|
23
23
|
rainbow (>= 2.2.2, < 4.0)
|
24
|
+
regexp_parser (>= 1.7)
|
24
25
|
rexml
|
26
|
+
rubocop-ast (>= 0.0.3)
|
25
27
|
ruby-progressbar (~> 1.7)
|
26
28
|
unicode-display_width (>= 1.4.0, < 2.0)
|
27
|
-
rubocop-
|
28
|
-
|
29
|
+
rubocop-ast (0.0.3)
|
30
|
+
parser (>= 2.7.0.1)
|
31
|
+
rubocop-shopify (1.0.3)
|
32
|
+
rubocop (~> 0.85.0)
|
29
33
|
ruby-progressbar (1.10.1)
|
30
34
|
unicode-display_width (1.7.0)
|
31
35
|
|
@@ -33,6 +37,7 @@ PLATFORMS
|
|
33
37
|
ruby
|
34
38
|
|
35
39
|
DEPENDENCIES
|
40
|
+
byebug
|
36
41
|
minitest (~> 5.0)
|
37
42
|
minitest-silence!
|
38
43
|
rake (~> 12.0)
|
@@ -15,20 +15,29 @@ module Minitest
|
|
15
15
|
end
|
16
16
|
|
17
17
|
module RunOneMethodPatch
|
18
|
+
attr_reader :original_stdin, :original_stdout, :original_stderr
|
19
|
+
|
20
|
+
def __run(*)
|
21
|
+
@original_stdin = $stdin.dup
|
22
|
+
@original_stdout = $stdout.dup
|
23
|
+
@original_stderr = $stderr.dup
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
18
27
|
def run_one_method(klass, method_name)
|
19
28
|
output_reader, output_writer = IO.pipe
|
20
29
|
output_thread = Thread.new { output_reader.read }
|
21
30
|
|
22
|
-
old_stdout = $stdout.dup
|
23
|
-
old_stderr = $stderr.dup
|
24
|
-
|
25
31
|
result = begin
|
26
32
|
$stdout.reopen(output_writer)
|
27
33
|
$stderr.reopen(output_writer)
|
34
|
+
$stdin.reopen(File::NULL)
|
35
|
+
|
28
36
|
super
|
29
37
|
ensure
|
30
|
-
$stdout.reopen(
|
31
|
-
$stderr.reopen(
|
38
|
+
$stdout.reopen(original_stdout)
|
39
|
+
$stderr.reopen(original_stderr)
|
40
|
+
$stdin.reopen(original_stdin)
|
32
41
|
output_writer.close
|
33
42
|
end
|
34
43
|
|
@@ -48,21 +57,26 @@ module Minitest
|
|
48
57
|
|
49
58
|
class << self
|
50
59
|
def plugin_silence_options(opts, options)
|
60
|
+
opts.on('--disable-silence', "Do not rebind standard IO") do
|
61
|
+
options[:disable_silence] = true
|
62
|
+
end
|
51
63
|
opts.on('--fail-on-output', "Fail a test when it writes to STDOUT or STDERR") do
|
52
64
|
options[:fail_on_output] = true
|
53
65
|
end
|
54
66
|
end
|
55
67
|
|
56
68
|
def plugin_silence_init(options)
|
57
|
-
|
58
|
-
|
69
|
+
unless options[:disable_silence]
|
70
|
+
Minitest::Result.prepend(Minitest::Silence::ResultOutputPatch)
|
71
|
+
Minitest.singleton_class.prepend(Minitest::Silence::RunOneMethodPatch)
|
59
72
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
73
|
+
if options[:fail_on_output]
|
74
|
+
# We have to make sure this reporter runs as the first reporter, so it can still adjust
|
75
|
+
# the result and other reporters will take the change into account.
|
76
|
+
reporter.reporters.unshift(Minitest::Silence::FailOnOutputReporter.new(options[:io], options))
|
77
|
+
elsif options[:verbose]
|
78
|
+
reporter << Minitest::Silence::BoxedOutputReporter.new(options[:io], options)
|
79
|
+
end
|
66
80
|
end
|
67
81
|
end
|
68
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-silence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|