test_budget 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e19638c3b0f42996339e6a676005e07193ee34017b67c636f241ec04c91b59d
4
- data.tar.gz: 68fff54ed7f1f4e888e18bb15db65888de38b5c76e6d5ff8fc3188cafdeb83d0
3
+ metadata.gz: 629009a91d15d30245f7a822ebb05fffc4a22b049d41f34750a7e3eee4ba3a73
4
+ data.tar.gz: 18067442b89424baafeeae02d9faa972214f09040f4b7fa5feb338076a9ea2d8
5
5
  SHA512:
6
- metadata.gz: ab0d1bef70892fa3ae89a504e380498307e97646b2f0a98dbd8ec20bd5cb858d1e99b5725fd043d7cfecf822cadf5a6e9c0a1e8760fe89791057b09916f3d0d6
7
- data.tar.gz: 5ef882443f34709c32785eb39ca669ea50a46fafee70e173ceaae534cb2da30845b53ba893d79554670dac5a30b63e9f1ac55263fc2e43029ed7082e049abac1
6
+ metadata.gz: ff11faadb6422e8af49ff601cf66e71e4ffed2743322ce6117642b0269273ed1b91cffe031e857168dec49a0b182c7209c1c72115d1fcbaef415b28b1bc720de
7
+ data.tar.gz: 9918fb99ddc3321d53db2c6ea0b7672adb6230a768055b8634cb88c0f833022914edaa8cbf75fccf273ca4dded3cfc8b031e519d94b0d4c556fb3bff580a1fdd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2026-03-05
3
+ ## [0.2.0] - 2026-11-23
4
+
5
+ - Add `diff` command to compare two test runs
6
+
7
+ ```
8
+ $ bundle exec test_budget diff tmp/before.json tmp/after.json
9
+ ┌───────────┬─────────┬─────────┬────────────┬─────────┐
10
+ │ Test Type │ Δ Count │ % │ Δ Duration │ % │
11
+ ├───────────┼─────────┼─────────┼────────────┼─────────┤
12
+ │ system │ -2 │ -50.0% │ -3m 8s │ -73.4% │
13
+ │ request │ +5 │ +41.7% │ +32s │ +41.0% │
14
+ │ job │ +4 │ new │ +3s │ new │
15
+ ├───────────┼─────────┼─────────┼────────────┼─────────┤
16
+ │ Total │ +7 │ +14.0% │ -2m 33s │ -39.5% │
17
+ └───────────┴─────────┴─────────┴────────────┴─────────┘
18
+ ```
19
+
20
+ - Add `breakdown` command to show time distribution across test types
21
+
22
+ ```
23
+ $ bundle exec test_budget breakdown
24
+ ┌───────────┬───────┬───────┬──────────┬───────┐
25
+ │ Test Type │ Count │ % │ Duration │ % │
26
+ ├───────────┼───────┼───────┼──────────┼───────┤
27
+ │ system │ 4 │ 8.0% │ 4m 16s │ 66.2% │
28
+ │ request │ 12 │ 24.0% │ 1m 18s │ 20.2% │
29
+ │ model │ 30 │ 60.0% │ 50s │ 12.9% │
30
+ │ job │ 4 │ 8.0% │ 3s │ 0.8% │
31
+ ├───────────┼───────┼───────┼──────────┼───────┤
32
+ │ Total │ 50 │ │ 6m 27s │ │
33
+ └───────────┴───────┴───────┴──────────┴───────┘
34
+ ```
35
+
36
+ - Add `--sort` flag to `breakdown` command (`duration`, `count`, or `type`)
37
+
38
+ ## [0.1.0] - 2026-03-09
4
39
 
5
40
  - Initial release
data/README.md CHANGED
@@ -17,7 +17,7 @@ before it gets worse.
17
17
  Add to your Gemfile:
18
18
 
19
19
  ```ruby
20
- gem "test_budget", github: "thoughtbot/test_budget"
20
+ gem "test_budget"
21
21
  ```
22
22
 
23
23
  > [!NOTE]
@@ -25,32 +25,36 @@ gem "test_budget", github: "thoughtbot/test_budget"
25
25
 
26
26
  ## Quick start
27
27
 
28
- Generate a starter config from an existing RSpec JSON results file:
28
+ Three steps: generate timing data, create a budget config, then audit.
29
29
 
30
- ```bash
31
- bundle exec test_budget init tmp/test_timings.json
32
- ```
33
-
34
- When given a results file, `init` derives budgets from your actual data (99th
35
- percentile + 10% tolerance, rounded to the nearest 0.5s). If you don't have a
36
- results file yet, run without arguments to generate a config with Rails
37
- defaults:
30
+ **1. Run your tests with JSON output** to collect timing data:
38
31
 
39
32
  ```bash
40
- bundle exec test_budget init
33
+ bundle exec rspec --format progress --format json --out tmp/test_timings.json
41
34
  ```
42
35
 
43
- Use `--force` to overwrite an existing `.test_budget.yml`.
36
+ > [!NOTE]
37
+ > Using a parallel runner? See [this section](#parallel-test-runners)
38
+ > for setup instructions.
44
39
 
45
- `estimate` is an alias for `init`. Use whichever name feels right:
40
+ **2. Generate a budget config** from the timing data:
46
41
 
47
42
  ```bash
48
- bundle exec test_budget estimate tmp/test_timings.json
43
+ bundle exec test_budget init tmp/test_timings.json
49
44
  ```
50
45
 
51
- Then run the audit after your tests:
46
+ This creates `.test_budget.yml` with budgets derived from your actual data
47
+ (see [Configuration](#configuration) for details). Edit it freely to match your
48
+ standards.
49
+
50
+ > [!TIP]
51
+ > Don't want to generate timing data first? Run `bundle exec test_budget init`
52
+ > without arguments to create a config with Rails defaults instead.
53
+
54
+ **3. Audit your test suite** against the budget:
52
55
 
53
56
  ```bash
57
+ bundle exec rspec --format progress --format json --out tmp/test_timings.json
54
58
  bundle exec test_budget audit
55
59
  ```
56
60
 
@@ -64,22 +68,17 @@ Test budget: 1 violation(s) found
64
68
  bundle exec test_budget allowlist spec/system/signup_spec.rb:15 --reason "<reason>"
65
69
  ```
66
70
 
67
- ## RSpec JSON results file
71
+ That's it. From here on, run the audit after every test run (see [CI
72
+ integration](#ci-integration)).
68
73
 
69
- > [!TIP]
70
- > You can skip this step and run `test_budget init` without a results
71
- > file to get started with Rails defaults right away.
72
-
73
- Add to your RSpec configuration or CI command:
74
+ ### Init options
74
75
 
75
- ```bash
76
- bundle exec rspec --format json --out tmp/test_timings.json
77
- ```
76
+ Use `--force` to overwrite an existing `.test_budget.yml`.
78
77
 
79
- Or combine with your usual formatter:
78
+ `estimate` is an alias for `init`. Use whichever name feels right:
80
79
 
81
80
  ```bash
82
- bundle exec rspec --format progress --format json --out tmp/test_timings.json
81
+ bundle exec test_budget estimate tmp/test_timings.json
83
82
  ```
84
83
 
85
84
  ### Parallel test runners
@@ -109,8 +108,11 @@ flatware rspec --format json --out tmp/test_timings.json
109
108
 
110
109
  ## Configuration
111
110
 
112
- The `init` command creates a `.test_budget.yml` in your project root. You can
113
- also create one manually:
111
+ The `init` command creates a `.test_budget.yml` in your project root with
112
+ budgets based on your actual data (per-test limits use the 99th percentile
113
+ rounded to the nearest 0.5s; the suite limit uses total duration + 10%
114
+ headroom). The generated file is a starting point — edit it freely to
115
+ match your team's standards. You can also create one manually:
114
116
 
115
117
  ```yaml
116
118
  timings_path: tmp/test_timings.json
@@ -200,6 +202,56 @@ Test budget: 2 violation(s) found
200
202
  2) Suite total (650.00s) exceeds limit (600.00s)
201
203
  ```
202
204
 
205
+ ## Breakdown
206
+
207
+ See where your test time goes:
208
+
209
+ ```bash
210
+ bundle exec test_budget breakdown tmp/test_timings.json
211
+ ```
212
+
213
+ Example output:
214
+
215
+ ```
216
+ ┌───────────┬───────┬───────┬──────────┬───────┐
217
+ │ Test Type │ Count │ % │ Duration │ % │
218
+ ├───────────┼───────┼───────┼──────────┼───────┤
219
+ │ system │ 4 │ 8.0% │ 4m 16s │ 66.2% │
220
+ │ request │ 12 │ 24.0% │ 1m 18s │ 20.2% │
221
+ │ model │ 30 │ 60.0% │ 50s │ 12.9% │
222
+ │ job │ 4 │ 8.0% │ 3s │ 0.8% │
223
+ ├───────────┼───────┼───────┼──────────┼───────┤
224
+ │ Total │ 50 │ │ 6m 27s │ │
225
+ └───────────┴───────┴───────┴──────────┴───────┘
226
+ ```
227
+
228
+ Without arguments, it reads from `tmp/test_timings.json`.
229
+
230
+ ## Diff
231
+
232
+ Compare two test runs to see what changed:
233
+
234
+ ```bash
235
+ bundle exec test_budget diff tmp/before.json tmp/after.json
236
+ ```
237
+
238
+ Example output:
239
+
240
+ ```
241
+ ┌───────────┬─────────┬─────────┬────────────┬─────────┐
242
+ │ Test Type │ Δ Count │ % │ Δ Duration │ % │
243
+ ├───────────┼─────────┼─────────┼────────────┼─────────┤
244
+ │ system │ -2 │ -50.0% │ -3m 8s │ -73.4% │
245
+ │ request │ +5 │ +41.7% │ +32s │ +41.0% │
246
+ │ job │ +4 │ new │ +3s │ new │
247
+ ├───────────┼─────────┼─────────┼────────────┼─────────┤
248
+ │ Total │ +7 │ +14.0% │ -2m 33s │ -39.5% │
249
+ └───────────┴─────────┴─────────┴────────────┴─────────┘
250
+ ```
251
+
252
+ New test types show `new` in the percent columns. Removed types show `-100.0%`.
253
+ Types with no change are hidden. When runs are identical, nothing is printed.
254
+
203
255
  ## CI integration
204
256
 
205
257
  Run the audit after your test suite:
@@ -5,7 +5,6 @@ require "yaml"
5
5
  module TestBudget
6
6
  class Budget
7
7
  class Estimate
8
- DEFAULT_TIMINGS_PATH = "tmp/test_timings.json"
9
8
  TOLERANCE = 0.10
10
9
  PER_TEST_CASE_DEFAULTS = {"default" => 3, "system" => 6, "request" => 3, "model" => 1.5}.freeze
11
10
 
@@ -36,7 +35,7 @@ module TestBudget
36
35
 
37
36
  def generate_from_results
38
37
  test_run = Parser::Rspec.parse(@timings_path)
39
- suite_budget = (test_run.suite_duration * (1 + TOLERANCE)).ceil
38
+ suite_budget = (test_run.wall_time * (1 + TOLERANCE)).ceil
40
39
  per_test_case_limits = derive_per_test_case(test_run.test_cases)
41
40
 
42
41
  budget = build_budget(
@@ -17,10 +17,12 @@ module TestBudget
17
17
  in "audit" then run_audit(args)
18
18
  in "allowlist" then run_allowlist(args)
19
19
  in "prune" then run_prune(args)
20
- in "init" then run_init(args)
20
+ in "init" | "estimate" then run_init(args)
21
+ in "breakdown" then run_breakdown(args)
22
+ in "diff" then run_diff(args)
21
23
  in "help" then print_help
22
24
  end
23
- rescue ArgumentParser::ParseError, TestBudget::Error, OptionParser::MissingArgument => e
25
+ rescue ArgumentParser::ParseError, TestBudget::Error, OptionParser::MissingArgument, OptionParser::InvalidArgument => e
24
26
  warn e.message
25
27
  1
26
28
  end
@@ -29,8 +31,7 @@ module TestBudget
29
31
 
30
32
  def command_parser
31
33
  ArgumentParser.build do
32
- required :command, pattern: {"audit" => "audit", "allowlist" => "allowlist", "prune" => "prune",
33
- "init" => "init", "estimate" => "init", "help" => "help"}
34
+ required :command, pattern: ["audit", "allowlist", "prune", "init", "estimate", "breakdown", "diff", "help"]
34
35
  end
35
36
  end
36
37
 
@@ -54,6 +55,8 @@ module TestBudget
54
55
  prune Remove obsolete allowlist entries
55
56
  init Generate starter .test_budget.yml config
56
57
  estimate Alias for init
58
+ breakdown Show time distribution across test types
59
+ diff Compare two test runs
57
60
  help Show this help message
58
61
 
59
62
  Options:
@@ -108,7 +111,7 @@ module TestBudget
108
111
  removed = Budget.load(budget_path).prune_allowlist
109
112
 
110
113
  if removed.any?
111
- puts "#{removed.size} obsolete allowlist #{(removed.size == 1) ? "entry" : "entries"} removed"
114
+ puts "#{removed.size} obsolete allowlist #{Inflector.pluralize("entry", removed.size)} removed"
112
115
  else
113
116
  puts "No obsolete allowlist entries found"
114
117
  end
@@ -116,6 +119,33 @@ module TestBudget
116
119
  0
117
120
  end
118
121
 
122
+ def run_breakdown(args)
123
+ sort = :duration
124
+
125
+ OptionParser.new do |opts|
126
+ opts.banner = "Usage: test_budget breakdown [timings_file] [options]"
127
+ opts.on("--sort FIELD", TestRun::Breakdown::SORT_OPTIONS, "Sort by: duration (default), count, type") { |s| sort = s }
128
+ end.parse!(args)
129
+
130
+ timings_path = args.shift || DEFAULT_TIMINGS_PATH
131
+ test_run = Parser::Rspec.parse(timings_path)
132
+ puts TestRun::Breakdown.new(test_run: test_run, sort: sort)
133
+ 0
134
+ end
135
+
136
+ def run_diff(args)
137
+ parsed_args = ArgumentParser.build {
138
+ required :before
139
+ required :after
140
+ }.parse!(args)
141
+
142
+ before = Parser::Rspec.parse(parsed_args[:before])
143
+ after = Parser::Rspec.parse(parsed_args[:after])
144
+
145
+ print TestRun::Diff.new(before, after)
146
+ 0
147
+ end
148
+
119
149
  def run_init(args)
120
150
  force = false
121
151
 
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestBudget
4
+ module Format
5
+ extend self
6
+
7
+ def duration(seconds)
8
+ if seconds >= 60
9
+ minutes = (seconds / 60).to_i
10
+ secs = (seconds % 60).round
11
+ "#{minutes}m #{secs}s"
12
+ else
13
+ "#{seconds.round}s"
14
+ end
15
+ end
16
+
17
+ def signed_duration(seconds)
18
+ formatted = duration(seconds.abs)
19
+
20
+ if seconds > 0
21
+ "+#{formatted}"
22
+ elsif seconds < 0
23
+ "-#{formatted}"
24
+ else
25
+ "0s"
26
+ end
27
+ end
28
+
29
+ def signed_int(n)
30
+ n.zero? ? "0" : "%+d" % n
31
+ end
32
+
33
+ def percent(value)
34
+ return "new" if value.nil?
35
+
36
+ "%+.1f%%" % value
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestBudget
4
+ module Inflector
5
+ IRREGULARS = {
6
+ "entry" => "entries",
7
+ "policy" => "policies",
8
+ "factory" => "factories",
9
+ "query" => "queries"
10
+ }.freeze
11
+
12
+ def self.pluralize(word, count)
13
+ (count == 1) ? word : (IRREGULARS[word] || "#{word}s")
14
+ end
15
+
16
+ def self.singularize(word)
17
+ IRREGULARS.key(word) || word.chomp("s")
18
+ end
19
+ end
20
+ end
@@ -14,7 +14,7 @@ module TestBudget
14
14
  groups = paths.flat_map { |path| parse_file(path) }
15
15
  TestRun.new(
16
16
  test_cases: groups.flatten,
17
- suite_duration: groups.map { |g| g.sum(&:duration) }.max || 0
17
+ wall_time: groups.map { |g| g.sum(&:duration) }.max || 0
18
18
  )
19
19
  end
20
20
 
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestBudget
4
+ class Table
5
+ def initialize(columns)
6
+ @columns = columns
7
+ end
8
+
9
+ def render(rows, footer:)
10
+ all_rows = [headers, *rows, footer]
11
+ widths = resolve_widths(all_rows)
12
+
13
+ header = format_row(headers, widths)
14
+ body = rows.map { |cells| format_row(cells, widths) }
15
+
16
+ [
17
+ horizontal_line("┌", "┬", "┐", widths),
18
+ header,
19
+ horizontal_line("├", "┼", "┤", widths),
20
+ *body,
21
+ horizontal_line("├", "┼", "┤", widths),
22
+ format_row(footer, widths),
23
+ horizontal_line("└", "┴", "┘", widths)
24
+ ].join("\n") + "\n"
25
+ end
26
+
27
+ private
28
+
29
+ def headers
30
+ @columns.map(&:first)
31
+ end
32
+
33
+ def resolve_widths(all_rows)
34
+ @columns.each_with_index.map { |_, i|
35
+ all_rows.map { |row| row[i].to_s.length }.max
36
+ }
37
+ end
38
+
39
+ def format_row(cells, widths)
40
+ parts = @columns.zip(cells, widths).map { |(_, alignment), cell, width|
41
+ case alignment
42
+ when :right then cell.to_s.rjust(width)
43
+ else cell.to_s.ljust(width)
44
+ end
45
+ }
46
+
47
+ "│ #{parts.join(" │ ")} │"
48
+ end
49
+
50
+ def horizontal_line(left, mid, right, widths)
51
+ segments = widths.map { |w| "─" * (w + 2) }
52
+ left + segments.join(mid) + right
53
+ end
54
+ end
55
+ end
@@ -6,17 +6,11 @@ module TestBudget
6
6
  super(file: file.delete_prefix("./"), name: name, duration: duration, status: status, line_number: line_number)
7
7
  end
8
8
 
9
- IRREGULAR_TYPES = {
10
- "policies" => :policy,
11
- "factories" => :factory,
12
- "queries" => :query
13
- }.freeze
14
-
15
9
  def type
16
10
  dir = file[%r{^spec/([^/]+)/}, 1]
17
11
  return :default unless dir
18
12
 
19
- IRREGULAR_TYPES[dir] || dir.chomp("s").to_sym
13
+ Inflector.singularize(dir).to_sym
20
14
  end
21
15
 
22
16
  def key
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestBudget
4
+ class TestRun
5
+ class Breakdown < Data.define(:test_run, :sort)
6
+ SORT_OPTIONS = %i[duration count type].freeze
7
+ TABLE = Table.new([
8
+ ["Test Type", :left],
9
+ ["Count", :right],
10
+ ["%", :right],
11
+ ["Duration", :right],
12
+ ["%", :right]
13
+ ])
14
+
15
+ def initialize(test_run:, sort: :duration) = super
16
+
17
+ def to_s
18
+ groups = test_run.groups
19
+ return "No test cases found.\n" if groups.empty?
20
+
21
+ rows = sort_groups(groups).map { |g|
22
+ [
23
+ g.type,
24
+ g.count.to_s,
25
+ "%.1f%%" % g.percent_count,
26
+ Format.duration(g.duration),
27
+ "%.1f%%" % g.percent_duration
28
+ ]
29
+ }
30
+
31
+ TABLE.render(
32
+ rows,
33
+ footer: ["Total", test_run.size.to_s, "", Format.duration(test_run.total_time), ""]
34
+ )
35
+ end
36
+
37
+ private
38
+
39
+ def sort_groups(groups)
40
+ case sort
41
+ when :count then groups.sort_by { |g| [-g.count, -g.duration] }
42
+ when :type then groups.sort_by { |g| g.type.to_s }
43
+ else groups.sort_by { |g| -g.duration }
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestBudget
4
+ class TestRun
5
+ Delta = Data.define(:label, :before, :after) do
6
+ def count = after.count - before.count
7
+ def duration = after.duration - before.duration
8
+
9
+ def new? = before.count == 0
10
+ def removed? = after.count == 0
11
+ def zero? = count == 0 && duration == 0
12
+
13
+ def percent_count
14
+ return if new?
15
+ return -100.0 if removed?
16
+
17
+ count * 100.0 / before.count
18
+ end
19
+
20
+ def percent_duration
21
+ return if new?
22
+ return -100.0 if removed?
23
+
24
+ duration * 100.0 / before.duration
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestBudget
4
+ class TestRun
5
+ class Diff < Data.define(:before, :after)
6
+ TABLE = Table.new([
7
+ ["Test Type", :left],
8
+ ["Δ Count", :right],
9
+ ["%", :right],
10
+ ["Δ Duration", :right],
11
+ ["%", :right]
12
+ ])
13
+
14
+ def to_s
15
+ rows = delta_rows
16
+ return "" if rows.empty?
17
+
18
+ TABLE.render(
19
+ rows.map { |r| format_row(r) },
20
+ footer: format_row(total)
21
+ )
22
+ end
23
+
24
+ private
25
+
26
+ NULL_GROUP = Group.new(type: :null, count: 0, duration: 0.0, test_run: nil)
27
+
28
+ def delta_rows
29
+ full_outer_join(before.groups, after.groups, by: :type, default: NULL_GROUP)
30
+ .map { |type, b, a| Delta.new(label: type, before: b, after: a) }
31
+ .reject(&:zero?)
32
+ .sort_by { |delta| [-delta.duration.abs, -delta.count.abs] }
33
+ end
34
+
35
+ def total = Delta.new(label: "Total", before: before, after: after)
36
+
37
+ def format_row(row) = [
38
+ row.label,
39
+ Format.signed_int(row.count),
40
+ Format.percent(row.percent_count),
41
+ Format.signed_duration(row.duration),
42
+ Format.percent(row.percent_duration)
43
+ ]
44
+
45
+ def full_outer_join(left, right, by:, default:)
46
+ left_index = left.to_h { |item| [item.public_send(by), item] }
47
+ right_index = right.to_h { |item| [item.public_send(by), item] }
48
+
49
+ (left_index.keys | right_index.keys).map do |key|
50
+ [key, left_index.fetch(key, default), right_index.fetch(key, default)]
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -1,13 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestBudget
4
- class TestRun < Data.define(:test_cases, :suite_duration)
4
+ class TestRun < Data.define(:test_cases, :wall_time)
5
+ Group = Data.define(:type, :count, :duration, :test_run) do
6
+ def percent_count = count * 100.0 / test_run.size
7
+
8
+ def percent_duration = duration * 100.0 / test_run.total_time
9
+ end
10
+
11
+ def size = test_cases.size
12
+ def total_time = test_cases.sum(&:duration)
13
+
14
+ alias_method :count, :size
15
+ alias_method :duration, :total_time
16
+
5
17
  def over?(budget)
6
18
  max = budget.suite.max_duration
7
19
  return if max.nil?
8
- return if suite_duration <= max
20
+ return if wall_time <= max
21
+
22
+ Violation.new(test_case: nil, duration: wall_time, limit: max, kind: :suite)
23
+ end
9
24
 
10
- Violation.new(test_case: nil, duration: suite_duration, limit: max, kind: :suite)
25
+ def groups
26
+ test_cases
27
+ .group_by(&:type)
28
+ .map { |type, cases|
29
+ Group.new(type: type, count: cases.size, duration: cases.sum(&:duration), test_run: self)
30
+ }
11
31
  end
12
32
  end
13
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestBudget
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/test_budget.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "test_budget/version"
4
+ require_relative "test_budget/inflector"
4
5
  require_relative "test_budget/allowlist"
5
6
  require_relative "test_budget/test_case"
6
7
  require_relative "test_budget/violation"
@@ -13,10 +14,16 @@ require_relative "test_budget/parser/rspec"
13
14
  require_relative "test_budget/audit"
14
15
  require_relative "test_budget/statistics"
15
16
  require_relative "test_budget/budget/estimate"
17
+ require_relative "test_budget/table"
18
+ require_relative "test_budget/format"
19
+ require_relative "test_budget/test_run/breakdown"
20
+ require_relative "test_budget/test_run/delta"
21
+ require_relative "test_budget/test_run/diff"
16
22
  require_relative "test_budget/cli"
17
23
 
18
24
  module TestBudget
19
25
  class Error < StandardError; end
20
26
 
21
27
  DEFAULT_BUDGET_PATH = ".test_budget.yml"
28
+ DEFAULT_TIMINGS_PATH = "tmp/test_timings.json"
22
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_budget
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
  - Matheus Richard
@@ -45,11 +45,17 @@ files:
45
45
  - lib/test_budget/budget.rb
46
46
  - lib/test_budget/budget/estimate.rb
47
47
  - lib/test_budget/cli.rb
48
+ - lib/test_budget/format.rb
49
+ - lib/test_budget/inflector.rb
48
50
  - lib/test_budget/parser/rspec.rb
49
51
  - lib/test_budget/reporter.rb
50
52
  - lib/test_budget/statistics.rb
53
+ - lib/test_budget/table.rb
51
54
  - lib/test_budget/test_case.rb
52
55
  - lib/test_budget/test_run.rb
56
+ - lib/test_budget/test_run/breakdown.rb
57
+ - lib/test_budget/test_run/delta.rb
58
+ - lib/test_budget/test_run/diff.rb
53
59
  - lib/test_budget/version.rb
54
60
  - lib/test_budget/violation.rb
55
61
  - lib/test_budget/warning.rb
@@ -60,6 +66,7 @@ metadata:
60
66
  homepage_uri: https://github.com/thoughtbot/test_budget
61
67
  source_code_uri: https://github.com/thoughtbot/test_budget
62
68
  changelog_uri: https://github.com/thoughtbot/test_budget/blob/main/CHANGELOG.md
69
+ rubygems_mfa_required: 'true'
63
70
  rdoc_options: []
64
71
  require_paths:
65
72
  - lib