rspec-conductor 1.0.5 → 1.0.6

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: 9ef8f45a737aff80987f79da1904c6c5bf208eb633dff2ba893b690369534901
4
- data.tar.gz: f8905660585569d61e9c939130a6e3ba6ae7f63b1821ea263f3d2a64fec76db2
3
+ metadata.gz: 53a28166d7b4df7bb4cfa3433a706ba3a5f892f4011535bb801718bc7886a638
4
+ data.tar.gz: 360ea91cb2e087b0f561616af2d37442bdbdb572b54520658a638feb2d7ebba4
5
5
  SHA512:
6
- metadata.gz: 46a26446160ea0de967ce28421077bc792cd0bdbe5ce1f772890f7104b2ae57fd3444d257d1564ea5067926c211d98b32bc002c23a8e54dda93ad4380dcbf9d6
7
- data.tar.gz: 145ae95cbdd382066b8ba7ccd909ec849a1a19b283d896f86db5584cafdb8cf88b0aa5ad45270a8dce427932f38cc79d9a2f803e1f29a9333a9a160f725e0286
6
+ metadata.gz: db723da5eb4be4e544bb4890427a83f96944b6c2fb293845fa5a892cb356d030d407ea246f46331d52f231a7158565e3ce18d4c0127adefe8a38fe515e0d738a
7
+ data.tar.gz: 3ceb9915c3da36f68c499cbe5d65787b9f88f46ed049e51c619b0b479d7e101fc963a2b90e62da0afba174e9960c07426d71b10cf13e8324edebf11df33a61ac
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [1.0.6] - 2026-02-14
2
+
3
+ - Better RSpec arguments handling, for example, --pattern and --exclude-pattern should be supported better (reported by @cb341)
4
+ - Add support for RSpec path inclusion filters (e.g. spec/hello_spec.rb:123 or spec/hello_spec.rb[1:2:1])
5
+
1
6
  ## [1.0.5] - 2026-02-13
2
7
 
3
8
  - Missed one more place where unqualified `Rails` was still shadowed by `RSpec::Rails`
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,3 @@
1
+ * Bug reports are always appreciated! I'll try to address them as soon as I can
2
+ * For the time being, I _will not_ accept code contributions. While it may sound weird at first, this here is not a large library, so I should be able to address all of the issues myself. There is also a question of code ownership, contributor agreements, etc etc, things I simply don't need in my life
3
+ * I _might_ accept and implement feature requests that make sense to me. My goal here is to keep a minimalistic zero-dependency kind of library and not expand the scope too much
data/Gemfile CHANGED
@@ -11,3 +11,4 @@ else
11
11
  gem "rspec", "~> #{ENV["RSPEC_VERSION"]}"
12
12
  end
13
13
  gem "benchmark-ips"
14
+ gem "irb"
data/README.md CHANGED
@@ -35,6 +35,23 @@ rspec-conductor --workers 10 spec
35
35
 
36
36
  Server process preloads the `rails_helper`, prepares a list of files to work, then spawns the workers, each with `ENV['TEST_ENV_NUMBER'] = <worker_number>` (same as parallel-tests). The two communicate over a standard unix socket. Message format is basically a tuple of `(size, json_payload)`. It should also be possible to run this process over the network, but I haven't found a solid usecase for this yet.
37
37
 
38
+ ## Formatters
39
+
40
+ rspec-conductor comes with 3 formatters out of the box:
41
+
42
+ * `--formatter plain` displays a bunch of dots, like `rspec --format progress`
43
+ * `--formatter ci` displays current progress every 10 seconds, useful in CI environments, especially if the output isn't flushed automatically for whatever reason (jenkins does that), looks like this:
44
+ ```
45
+ --------------------------------
46
+ Current status [17:37:11]:
47
+ Processed: 24 / 159 (15%)
48
+ 322 passed, 0 failed, 0 pending
49
+ --------------------------------
50
+ ```
51
+ * `--formatter fancy` is the formatter shown in the gif above, it displays a list of workers, a row of dots and the last error message (if any). Useful for local development.
52
+
53
+ When launched without an explicitly specified formatter option, rspec-conductor defaults to either `plain` or `fancy` depending on the terminal parameters.
54
+
38
55
  ## Setting up the databases in Rails
39
56
 
40
57
  If you want ten workers, you're going to need ten databases. Something like this in your `database.yml` file:
@@ -66,9 +83,11 @@ rails rspec_conductor:setup # assumes [10]
66
83
 
67
84
  ```
68
85
 
69
- ## Development notes
86
+ ## Development philosophy
87
+
88
+ This library is very minimalistic by design. While there is a dependency on rspec-core, obviously, but there are no dependencies beyond that. Even the TUI stuff is handled internally.
70
89
 
71
- * In order to make the CLI executable load and run fast, do not add any dependencies. That includes `active_support`.
90
+ I will also try my best to keep supporting as many rubies / rspec versions as I can, which is, currently, ruby 2.6.0+ (released in 2018) and rspec 3.8.0+ (also released in 2018), although that is more of a soft promise than a blood vow.
72
91
 
73
92
  ## Troubleshooting
74
93
 
@@ -47,7 +47,6 @@ module RSpec
47
47
 
48
48
  parse_conductor_options(conductor_args)
49
49
  @rspec_args.prepend(*conductor_args) # can use spec paths as positional arguments before -- for convenience
50
- apply_rspec_defaults
51
50
  end
52
51
 
53
52
  def parse_conductor_options(args)
@@ -109,11 +108,6 @@ module RSpec
109
108
  end.parse!(args)
110
109
  end
111
110
 
112
- def apply_rspec_defaults
113
- has_paths = @rspec_args.any? { |arg| !arg.start_with?("-") }
114
- @rspec_args << File.join(Conductor.root, "spec/") unless has_paths
115
- end
116
-
117
111
  def start_server
118
112
  Server.new(
119
113
  worker_count: @conductor_options[:workers],
@@ -46,6 +46,8 @@ module RSpec
46
46
  (!@verbose && Formatters::Fancy.recommended?) ? Formatters::Fancy.new(worker_count: worker_count) : Formatters::Plain.new
47
47
  end
48
48
  @results = Results.new
49
+
50
+ Dir.chdir(Conductor.root)
49
51
  end
50
52
 
51
53
  def run
@@ -73,7 +75,7 @@ module RSpec
73
75
  return
74
76
  end
75
77
 
76
- preload = File.expand_path(@prefork_require, Conductor.root)
78
+ preload = File.expand_path(@prefork_require)
77
79
 
78
80
  if File.exist?(preload)
79
81
  debug "Preloading #{@prefork_require}..."
@@ -102,24 +104,19 @@ module RSpec
102
104
  end
103
105
 
104
106
  def build_spec_queue
105
- paths = extract_paths_from_args
106
-
107
+ config_options = RSpec::Core::ConfigurationOptions.new(@rspec_args)
108
+ if config_options.options[:files_or_directories_to_run].empty?
109
+ config_options.options[:files_or_directories_to_run] = ["spec"]
110
+ end
107
111
  config = RSpec::Core::Configuration.new
108
- config.files_or_directories_to_run = paths
109
-
112
+ debug "RSpec config options: #{config_options.inspect}"
113
+ config_options.configure(config)
114
+ debug "RSpec config: #{config.inspect}"
115
+ debug "Files to run: #{config.files_to_run}"
110
116
  @spec_queue = config.files_to_run.shuffle(random: Random.new(@seed))
111
117
  @results.spec_files_total = @spec_queue.size
112
118
  end
113
119
 
114
- def parsed_rspec_args
115
- @parsed_rspec_args ||= RSpec::Core::ConfigurationOptions.new(@rspec_args)
116
- end
117
-
118
- def extract_paths_from_args
119
- files = parsed_rspec_args.options[:files_or_directories_to_run] || []
120
- files.empty? ? [File.join(Conductor.root, "spec/")] : files
121
- end
122
-
123
120
  def start_workers
124
121
  @worker_count.times do |i|
125
122
  spawn_worker(@worker_number_offset + i + 1)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Conductor
5
- VERSION = "1.0.5"
5
+ VERSION = "1.0.6"
6
6
  end
7
7
  end
@@ -60,7 +60,7 @@ module RSpec
60
60
  def setup_load_path
61
61
  parsed_options.configure(RSpec.configuration)
62
62
  @default_path = RSpec.configuration.default_path || "spec"
63
- @default_full_path = File.expand_path(@default_path, Conductor.root)
63
+ @default_full_path = File.expand_path(@default_path)
64
64
 
65
65
  if Dir.exist?(@default_full_path) && !$LOAD_PATH.include?(@default_full_path)
66
66
  $LOAD_PATH.unshift(@default_full_path)
@@ -106,12 +106,14 @@ module RSpec
106
106
 
107
107
  def run_spec(file)
108
108
  RSpec.world.reset
109
- RSpec.configuration.reset_reporter
110
- RSpec.configuration.files_or_directories_to_run = []
109
+ RSpec.configuration.reset
110
+ RSpec.configuration.files_or_directories_to_run = [file]
111
111
  RSpec.configuration.output_stream = null_io_out
112
112
  RSpec.configuration.error_stream = null_io_out
113
113
  RSpec.configuration.formatter_loader.formatters.clear
114
114
  RSpec.configuration.add_formatter(RSpecSubscriber.new(@socket, file, -> { check_for_shutdown }))
115
+ parsed_options.configure(RSpec.configuration)
116
+ RSpec.configuration.files_to_run # this seemingly random line is necessary for rspec to set up the inclusion filters (e.g. hello_spec.rb:123 -> the :123 part is an inclusion filter)
115
117
 
116
118
  begin
117
119
  debug "Loading spec file: #{file}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-conductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Abramov
@@ -33,6 +33,7 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - ".rspec"
35
35
  - CHANGELOG.md
36
+ - CONTRIBUTING.md
36
37
  - Gemfile
37
38
  - LICENSE.txt
38
39
  - README.md