cypress-rails 0.9.0 → 0.9.1

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: c08ef4f9087d66f0f04df9831568414e757aae3fb83baf6bfd85c0d7a3509312
4
- data.tar.gz: aa4baeebd6d8035ca9b9fc6ba91b0c487e9cf3a385a25ee9da92c96e2fd4ce2c
3
+ metadata.gz: b093a78636180632c4ce0b8ca2676c576601567bd27d536fb63b7eb0f65dcc55
4
+ data.tar.gz: e22ee94a3417062864d003405e66f24e3e120ba519fba2c7f3ff5b3a35788c80
5
5
  SHA512:
6
- metadata.gz: 15cf818dd04eb1eb89853d2a14839dd54d25ed4c39b21a705fcae507c7cecb12813477913fab43e486a7f80f0bcc4df8cb18cafa0252d3a38c33608b8441c6b7
7
- data.tar.gz: 2fa87db917ccc275d14c8dc28f67a55c13a375e13d6a9f25887fc9ad87989d18bb515b2eabab19ef58dcee6da9b098cf1ccabf97ee6a057649468d8f4f740245
6
+ metadata.gz: c40265543d3f949ed4f3968ca64fffc3a9c0e00136593b7eca96bf1600bc4e9843a4b181c2af7923cb75bf08ee95a772f8c30660309b453c9251feb77448c1cb
7
+ data.tar.gz: 1eace28c079abe961bd36c889c12f944acdd8ccf0c54f451959734efaab173da5e038503824bc2c0b39f53ff0c185a040a862316f059bfca4a9128a859012435
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.9.1
4
+
5
+ * Add `CYPRESS_RAILS_SERVER_THREADS` (default: `"0:4"`) to configure the min:max
6
+ thread count passed to Puma's `Threads:` option, so you can e.g. set it to
7
+ `"1:1"` for single-threaded mode.
8
+
3
9
  ## 0.9.0
4
10
 
5
11
  * **[Breaking]** Require Rails 7.1 or newer
data/README.md CHANGED
@@ -216,6 +216,10 @@ preferred environment variables project-wide using a tool like
216
216
  transactional server](#turning-off-the-transactional-server)
217
217
  * **CYPRESS_RAILS_CYPRESS_OPTS** (default: _none_) any options you want to
218
218
  forward to the Cypress CLI when running its `open` or `run` commands.
219
+ * **CYPRESS_RAILS_SERVER_THREADS** (default: `"0:4"`) the min:max thread count
220
+ passed to Puma's `Threads:` option when cypress-rails boots its own test
221
+ server. Set to `"1:1"` for single-threaded mode. This is independent of your
222
+ app's `config/puma.rb`, which cypress-rails does not read.
219
223
 
220
224
  #### Example: Running a single spec from the command line
221
225
 
@@ -2,7 +2,7 @@ require_relative "env"
2
2
 
3
3
  module CypressRails
4
4
  class Config
5
- attr_accessor :rails_dir, :cypress_dir, :host, :port, :base_path, :transactional_server, :cypress_cli_opts
5
+ attr_accessor :rails_dir, :cypress_dir, :host, :port, :base_path, :transactional_server, :cypress_cli_opts, :server_threads
6
6
 
7
7
  def initialize(
8
8
  rails_dir: Env.fetch("CYPRESS_RAILS_DIR", default: Dir.pwd),
@@ -11,7 +11,8 @@ module CypressRails
11
11
  port: Env.fetch("CYPRESS_RAILS_PORT"),
12
12
  base_path: Env.fetch("CYPRESS_RAILS_BASE_PATH", default: "/"),
13
13
  transactional_server: Env.fetch("CYPRESS_RAILS_TRANSACTIONAL_SERVER", type: :boolean, default: true),
14
- cypress_cli_opts: Env.fetch("CYPRESS_RAILS_CYPRESS_OPTS", default: "")
14
+ cypress_cli_opts: Env.fetch("CYPRESS_RAILS_CYPRESS_OPTS", default: ""),
15
+ server_threads: Env.fetch("CYPRESS_RAILS_SERVER_THREADS", default: "0:4")
15
16
  )
16
17
  @rails_dir = rails_dir
17
18
  @cypress_dir = cypress_dir
@@ -20,6 +21,7 @@ module CypressRails
20
21
  @base_path = base_path
21
22
  @transactional_server = transactional_server
22
23
  @cypress_cli_opts = cypress_cli_opts
24
+ @server_threads = server_threads
23
25
  end
24
26
 
25
27
  def to_s
@@ -34,6 +36,7 @@ module CypressRails
34
36
  CYPRESS_RAILS_BASE_PATH...............#{base_path.inspect}
35
37
  CYPRESS_RAILS_TRANSACTIONAL_SERVER....#{transactional_server.inspect}
36
38
  CYPRESS_RAILS_CYPRESS_OPTS............#{cypress_cli_opts.inspect}
39
+ CYPRESS_RAILS_SERVER_THREADS..........#{server_threads.inspect}
37
40
 
38
41
  DESC
39
42
  end
@@ -22,7 +22,8 @@ module CypressRails
22
22
  server = @starts_rails_server.call(
23
23
  host: config.host,
24
24
  port: config.port,
25
- transactional_server: config.transactional_server
25
+ transactional_server: config.transactional_server,
26
+ server_threads: config.server_threads
26
27
  )
27
28
  bin = @finds_bin.call(config.cypress_dir)
28
29
 
@@ -1,14 +1,12 @@
1
1
  module CypressRails
2
2
  class Server
3
3
  module Puma
4
- def self.create(app, port, host)
4
+ def self.create(app, port, host, threads = "0:4")
5
5
  require "rack/handler/puma"
6
6
 
7
7
  # If we just run the Puma Rack handler it installs signal handlers which prevent us from being able to interrupt tests.
8
8
  # Therefore construct and run the Server instance ourselves.
9
- # Rack::Handler::Puma.run(app, { Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false }.merge(options))
10
- default_options = {Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false}
11
- options = default_options # .merge(options)
9
+ options = {Host: host, Port: port, Threads: threads, workers: 0, daemon: false}
12
10
 
13
11
  puma_rack_handler = defined?(Rackup::Handler::Puma) ? Rackup::Handler::Puma : Rack::Handler::Puma
14
12
  conf = puma_rack_handler.config(app, options)
@@ -25,7 +25,8 @@ module CypressRails
25
25
  reportable_errors: [Exception],
26
26
  extra_middleware: [],
27
27
  initializer_hooks: InitializerHooks.instance,
28
- puma: Puma)
28
+ puma: Puma,
29
+ threads: "0:4")
29
30
  @app = app
30
31
  @extra_middleware = extra_middleware
31
32
  @server_thread = nil # suppress warnings
@@ -37,6 +38,7 @@ module CypressRails
37
38
  @checker = Checker.new(@host, @port)
38
39
  @initializer_hooks = initializer_hooks
39
40
  @puma = puma
41
+ @threads = threads
40
42
  end
41
43
 
42
44
  def reset_error!
@@ -75,7 +77,7 @@ module CypressRails
75
77
  Server.ports[port_key] = port
76
78
 
77
79
  @server_thread = Thread.new {
78
- @puma.create(middleware, port, host)
80
+ @puma.create(middleware, port, host, @threads)
79
81
  }
80
82
 
81
83
  timer = Timer.new(60)
@@ -3,9 +3,9 @@ require_relative "server"
3
3
 
4
4
  module CypressRails
5
5
  class StartsRailsServer
6
- def call(host:, port:, transactional_server:)
6
+ def call(host:, port:, transactional_server:, server_threads:)
7
7
  app = create_rack_app(transactional_server)
8
- Server.new(app, host: host, port: port).tap do |server|
8
+ Server.new(app, host: host, port: port, threads: server_threads).tap do |server|
9
9
  server.boot
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module CypressRails
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cypress-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls