knapsack_pro 0.46.0 → 0.47.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/lib/knapsack_pro/adapters/base_adapter.rb +5 -0
- data/lib/knapsack_pro/adapters/rspec_adapter.rb +8 -0
- data/lib/knapsack_pro/formatters/rspec_queue_summary_formatter.rb +16 -1
- data/lib/knapsack_pro/report.rb +0 -1
- data/lib/knapsack_pro/tracker.rb +11 -9
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/adapters/base_adapter_spec.rb +11 -0
- data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +13 -0
- data/spec/knapsack_pro/report_spec.rb +1 -2
- data/spec/knapsack_pro/tracker_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 134f144c4fb7cd10705a73ccf858439ee3d9e907
|
4
|
+
data.tar.gz: 4edada383933812bbb739d7f471a28b21530492a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ab40a05f0201ce49cc2c184741d31327e2a2ae2317b1895e7e6cba258c53062aa3bb9b8032141c9476f9ed20bb617c2c9fd55c84250cb7eaeec58c63d7d66c9
|
7
|
+
data.tar.gz: 482638d2f37f274b7cc3cc512d8dc24a8e5a6dd562e35c31cc8d373d8b3690cea0a23d1965844ce060d742b3e3493b3557d4118b7b2baef14b77f385efefd3f9
|
data/CHANGELOG.md
CHANGED
@@ -2,9 +2,18 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 0.47.0
|
6
|
+
|
7
|
+
* Add in Queue Mode the RSpec summary with info about examples, failures and pending tests.
|
8
|
+
* Fix not working message `Global time execution for tests` at end of each subset of tests from work queue.
|
9
|
+
|
10
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/48
|
11
|
+
|
12
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.46.0...v0.47.0
|
13
|
+
|
5
14
|
### 0.46.0
|
6
15
|
|
7
|
-
* Autoload knapsack_pro rake tasks with Rails Railties
|
16
|
+
* Autoload knapsack_pro rake tasks with Rails Railties.
|
8
17
|
|
9
18
|
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/47
|
10
19
|
|
@@ -19,6 +19,7 @@ module KnapsackPro
|
|
19
19
|
|
20
20
|
if KnapsackPro::Config::Env.queue_recording_enabled?
|
21
21
|
KnapsackPro.logger.debug('Test suite time execution queue recording enabled.')
|
22
|
+
bind_tracker_reset
|
22
23
|
bind_before_queue_hook
|
23
24
|
bind_time_tracker
|
24
25
|
bind_save_queue_report
|
@@ -37,6 +38,10 @@ module KnapsackPro
|
|
37
38
|
raise NotImplementedError
|
38
39
|
end
|
39
40
|
|
41
|
+
def bind_tracker_reset
|
42
|
+
raise NotImplementedError
|
43
|
+
end
|
44
|
+
|
40
45
|
def bind_before_queue_hook
|
41
46
|
raise NotImplementedError
|
42
47
|
end
|
@@ -58,6 +58,14 @@ module KnapsackPro
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def bind_tracker_reset
|
62
|
+
::RSpec.configure do |config|
|
63
|
+
config.before(:suite) do
|
64
|
+
KnapsackPro.tracker.reset!
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
61
69
|
def bind_before_queue_hook
|
62
70
|
::RSpec.configure do |config|
|
63
71
|
config.before(:suite) do
|
@@ -10,7 +10,7 @@ module KnapsackPro
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class RSpecQueueSummaryFormatter < RSpec::Core::Formatters::BaseFormatter
|
13
|
-
RSpec::Core::Formatters.register self, :dump_failures, :dump_pending
|
13
|
+
RSpec::Core::Formatters.register self, :dump_summary, :dump_failures, :dump_pending
|
14
14
|
|
15
15
|
def self.registered_output=(output)
|
16
16
|
@registered_output = {
|
@@ -86,6 +86,21 @@ module KnapsackPro
|
|
86
86
|
return if notification.pending_examples.empty?
|
87
87
|
self.class.most_recent_pending = notification.fully_formatted_pending_examples
|
88
88
|
end
|
89
|
+
|
90
|
+
def dump_summary(summary)
|
91
|
+
colorizer = ::RSpec::Core::Formatters::ConsoleCodes
|
92
|
+
duration = KnapsackPro.tracker.global_time_since_beginning
|
93
|
+
formatted_duration = ::RSpec::Core::Formatters::Helpers.format_duration(duration)
|
94
|
+
|
95
|
+
formatted = "\nFinished in #{formatted_duration}\n" \
|
96
|
+
"#{summary.colorized_totals_line(colorizer)}\n"
|
97
|
+
|
98
|
+
unless summary.failed_examples.empty?
|
99
|
+
formatted += (summary.colorized_rerun_commands(colorizer) + "\n")
|
100
|
+
end
|
101
|
+
|
102
|
+
self.class.most_recent_summary = formatted
|
103
|
+
end
|
89
104
|
end
|
90
105
|
end
|
91
106
|
end
|
data/lib/knapsack_pro/report.rb
CHANGED
data/lib/knapsack_pro/tracker.rb
CHANGED
@@ -2,10 +2,11 @@ module KnapsackPro
|
|
2
2
|
class Tracker
|
3
3
|
include Singleton
|
4
4
|
|
5
|
-
attr_reader :global_time, :test_files_with_time
|
5
|
+
attr_reader :global_time_since_beginning, :global_time, :test_files_with_time
|
6
6
|
attr_writer :current_test_path
|
7
7
|
|
8
8
|
def initialize
|
9
|
+
@global_time_since_beginning = 0
|
9
10
|
set_defaults
|
10
11
|
end
|
11
12
|
|
@@ -18,10 +19,10 @@ module KnapsackPro
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def stop_timer
|
21
|
-
|
22
|
-
update_global_time
|
23
|
-
update_test_file_time
|
24
|
-
|
22
|
+
execution_time = @start_time ? now_without_mock_time.to_f - @start_time : 0.0
|
23
|
+
update_global_time(execution_time)
|
24
|
+
update_test_file_time(execution_time)
|
25
|
+
execution_time
|
25
26
|
end
|
26
27
|
|
27
28
|
def current_test_path
|
@@ -48,13 +49,14 @@ module KnapsackPro
|
|
48
49
|
@test_path = nil
|
49
50
|
end
|
50
51
|
|
51
|
-
def update_global_time
|
52
|
-
@global_time +=
|
52
|
+
def update_global_time(execution_time)
|
53
|
+
@global_time += execution_time
|
54
|
+
@global_time_since_beginning += execution_time
|
53
55
|
end
|
54
56
|
|
55
|
-
def update_test_file_time
|
57
|
+
def update_test_file_time(execution_time)
|
56
58
|
@test_files_with_time[current_test_path] ||= 0
|
57
|
-
@test_files_with_time[current_test_path] +=
|
59
|
+
@test_files_with_time[current_test_path] += execution_time
|
58
60
|
end
|
59
61
|
|
60
62
|
def now_without_mock_time
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -48,6 +48,7 @@ describe KnapsackPro::Adapters::BaseAdapter do
|
|
48
48
|
let(:queue_recording_enabled?) { true }
|
49
49
|
|
50
50
|
before do
|
51
|
+
allow(subject).to receive(:bind_tracker_reset)
|
51
52
|
allow(subject).to receive(:bind_before_queue_hook)
|
52
53
|
allow(subject).to receive(:bind_time_tracker)
|
53
54
|
allow(subject).to receive(:bind_save_queue_report)
|
@@ -58,12 +59,14 @@ describe KnapsackPro::Adapters::BaseAdapter do
|
|
58
59
|
expect(KnapsackPro).to receive(:logger).and_return(logger)
|
59
60
|
expect(logger).to receive(:debug).with('Test suite time execution queue recording enabled.')
|
60
61
|
end
|
62
|
+
it { expect(subject).to receive(:bind_tracker_reset) }
|
61
63
|
it { expect(subject).to receive(:bind_before_queue_hook) }
|
62
64
|
it { expect(subject).to receive(:bind_time_tracker) }
|
63
65
|
it { expect(subject).to receive(:bind_save_queue_report) }
|
64
66
|
end
|
65
67
|
|
66
68
|
context 'when recording disabled' do
|
69
|
+
it { expect(subject).not_to receive(:bind_tracker_reset) }
|
67
70
|
it { expect(subject).not_to receive(:bind_time_tracker) }
|
68
71
|
it { expect(subject).not_to receive(:bind_save_report) }
|
69
72
|
it { expect(subject).not_to receive(:bind_save_queue_report) }
|
@@ -95,6 +98,14 @@ describe KnapsackPro::Adapters::BaseAdapter do
|
|
95
98
|
end
|
96
99
|
end
|
97
100
|
|
101
|
+
describe '#bind_tracker_reset' do
|
102
|
+
it do
|
103
|
+
expect {
|
104
|
+
subject.bind_tracker_reset
|
105
|
+
}.to raise_error(NotImplementedError)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
98
109
|
describe '#bind_before_queue_hook' do
|
99
110
|
it do
|
100
111
|
expect {
|
@@ -124,6 +124,19 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
describe '#bind_tracker_reset' do
|
128
|
+
it do
|
129
|
+
expect(config).to receive(:before).with(:suite).and_yield
|
130
|
+
expect(::RSpec).to receive(:configure).and_yield(config)
|
131
|
+
|
132
|
+
tracker = instance_double(KnapsackPro::Tracker)
|
133
|
+
expect(KnapsackPro).to receive(:tracker).and_return(tracker)
|
134
|
+
expect(tracker).to receive(:reset!)
|
135
|
+
|
136
|
+
subject.bind_tracker_reset
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
127
140
|
describe '#bind_before_queue_hook' do
|
128
141
|
it do
|
129
142
|
expect(config).to receive(:before).with(:suite).and_yield
|
@@ -20,8 +20,7 @@ describe KnapsackPro::Report do
|
|
20
20
|
before do
|
21
21
|
test_files = [{path: fake_path}]
|
22
22
|
tracker = instance_double(KnapsackPro::Tracker, to_a: test_files)
|
23
|
-
expect(KnapsackPro).to receive(:tracker).
|
24
|
-
expect(tracker).to receive(:reset!)
|
23
|
+
expect(KnapsackPro).to receive(:tracker).and_return(tracker)
|
25
24
|
|
26
25
|
subset_queue_id = 'fake-subset-queue-id'
|
27
26
|
expect(KnapsackPro::Config::Env).to receive(:subset_queue_id).and_return(subset_queue_id)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.47.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|