anyt 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. metadata +13 -119
  4. data/bin/console +0 -7
  5. data/bin/setup +0 -8
  6. data/lib/anyt/cli.rb +0 -194
  7. data/lib/anyt/client.rb +0 -112
  8. data/lib/anyt/command.rb +0 -63
  9. data/lib/anyt/config.rb +0 -41
  10. data/lib/anyt/dummy/application.rb +0 -83
  11. data/lib/anyt/dummy/config.ru +0 -16
  12. data/lib/anyt/dummy/routes.rb +0 -4
  13. data/lib/anyt/dummy/tmp/development_secret.txt +0 -1
  14. data/lib/anyt/ext/minitest.rb +0 -150
  15. data/lib/anyt/remote_control.rb +0 -33
  16. data/lib/anyt/rpc.rb +0 -46
  17. data/lib/anyt/tests/core/ping_test.rb +0 -23
  18. data/lib/anyt/tests/core/welcome_test.rb +0 -10
  19. data/lib/anyt/tests/features/channel_state_test.rb +0 -81
  20. data/lib/anyt/tests/features/remote_disconnect_test.rb +0 -35
  21. data/lib/anyt/tests/features/server_restart_test.rb +0 -30
  22. data/lib/anyt/tests/request/channel_test.rb +0 -28
  23. data/lib/anyt/tests/request/connection_test.rb +0 -54
  24. data/lib/anyt/tests/request/disconnect_reasons_test.rb +0 -25
  25. data/lib/anyt/tests/request/disconnection_test.rb +0 -148
  26. data/lib/anyt/tests/streams/broadcast_test.rb +0 -65
  27. data/lib/anyt/tests/streams/multiple_clients_test.rb +0 -61
  28. data/lib/anyt/tests/streams/multiple_test.rb +0 -60
  29. data/lib/anyt/tests/streams/single_test.rb +0 -83
  30. data/lib/anyt/tests/streams/stop_test.rb +0 -57
  31. data/lib/anyt/tests/subscriptions/ack_test.rb +0 -39
  32. data/lib/anyt/tests/subscriptions/params_test.rb +0 -29
  33. data/lib/anyt/tests/subscriptions/perform_test.rb +0 -60
  34. data/lib/anyt/tests/subscriptions/transmissions_test.rb +0 -32
  35. data/lib/anyt/tests.rb +0 -62
  36. data/lib/anyt/utils/async_helpers.rb +0 -16
  37. data/lib/anyt/utils.rb +0 -3
  38. data/lib/anyt/version.rb +0 -5
  39. data/lib/anyt.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98e0ff916d9b26a1c59c1590deaf1991e5b03e9307d9939069d2a7f16360c8a5
4
- data.tar.gz: 8e425053f5af7706d9a3ea478d6b08e43ef6b7fe15f58fa0c97800c6aafcaff8
3
+ metadata.gz: 6565c7892e2d696ae9f572a557be099c8cf3fff66182d65cd5d784916f97e4bd
4
+ data.tar.gz: 98975a1b4659126da5ba39380cb6ec218dc9c6c38a7970d90d9a6865cab768c5
5
5
  SHA512:
6
- metadata.gz: ef09aae331254a361fe2f62d5f0d00bcac7c1f353c90f88f225cbff3d3e16b145e1225c28d026c3aabe5bac01bcef52944f6a5a4846d48ff4f0ff0841d5ae1ac
7
- data.tar.gz: 06ecdbdf18997b6ed3e7e4d13a8a68069b35bcd1db124c27cbcb11c739e68abbd7e168b655cf0b1c366d3ab0d72b6e9d65394472c5135e9b31d25790e13124a7
6
+ metadata.gz: ea3d7302dd78f6aeee2de72760cfcb48b53c298109830aac85dace3e5ddc35c191457d7ea846f1f99cc97f4fbf25bc6b6bb7b0284d50d0ff2c5f49f32ce6c734
7
+ data.tar.gz: 9fdf6962eaa713eb3581359e78f7d2090af6b73dd2997ef7906ba98d0483b17c47dfd55f7866709e56b69ae02eb118d7b494dbc3481c5fce8bf6a230822a2772
data/README.md CHANGED
@@ -2,9 +2,10 @@
2
2
  [![Gem Version](https://badge.fury.io/rb/anyt.svg)](https://rubygems.org/gems/anyt)
3
3
  ![Test](https://github.com/anycable/anyt/workflows/Test/badge.svg)
4
4
 
5
- # AnyCable Conformance Testing Tool
5
+ # Action Cable / AnyCable conformance testing tool
6
+
7
+ AnyT is a command-line tool to test your Action Cable or [AnyCable](http://anycable.io)-compatible WebSocket servers.
6
8
 
7
- AnyT is a command-line tool to test your [AnyCable](http://anycable.io)-compatible WebSocket servers.
8
9
  It contains a set of tests to determine which features are supported by the implementation under consideration.
9
10
 
10
11
  ## Installation
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anyt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-23 00:00:00.000000000 Z
11
+ date: 2024-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rack
14
+ name: anyt-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: 1.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: 1.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,34 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.1.0
55
- - !ruby/object:Gem::Dependency
56
- name: rails
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '6.0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '6.0'
69
- - !ruby/object:Gem::Dependency
70
- name: anyway_config
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 2.2.0
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 2.2.0
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: anycable-rails
85
57
  requirement: !ruby/object:Gem::Requirement
@@ -114,48 +86,6 @@ dependencies:
114
86
  - - "~>"
115
87
  - !ruby/object:Gem::Version
116
88
  version: '4.0'
117
- - !ruby/object:Gem::Dependency
118
- name: websocket
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: 1.2.4
124
- type: :runtime
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: 1.2.4
131
- - !ruby/object:Gem::Dependency
132
- name: websocket-client-simple
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: 0.3.0
138
- type: :runtime
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: 0.3.0
145
- - !ruby/object:Gem::Dependency
146
- name: concurrent-ruby
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '1.0'
152
- type: :runtime
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '1.0'
159
89
  - !ruby/object:Gem::Dependency
160
90
  name: childprocess
161
91
  requirement: !ruby/object:Gem::Requirement
@@ -204,15 +134,15 @@ dependencies:
204
134
  requirements:
205
135
  - - "~>"
206
136
  - !ruby/object:Gem::Version
207
- version: '3.6'
137
+ version: '6.0'
208
138
  type: :development
209
139
  prerelease: false
210
140
  version_requirements: !ruby/object:Gem::Requirement
211
141
  requirements:
212
142
  - - "~>"
213
143
  - !ruby/object:Gem::Version
214
- version: '3.6'
215
- description: Anycable conformance testing tool
144
+ version: '6.0'
145
+ description: Action Cable / AnyCable conformance testing tool
216
146
  email:
217
147
  - dementiev.vm@gmail.com
218
148
  executables:
@@ -223,42 +153,6 @@ files:
223
153
  - MIT-LICENSE
224
154
  - README.md
225
155
  - bin/anyt
226
- - bin/console
227
- - bin/setup
228
- - lib/anyt.rb
229
- - lib/anyt/cli.rb
230
- - lib/anyt/client.rb
231
- - lib/anyt/command.rb
232
- - lib/anyt/config.rb
233
- - lib/anyt/dummy/application.rb
234
- - lib/anyt/dummy/config.ru
235
- - lib/anyt/dummy/routes.rb
236
- - lib/anyt/dummy/tmp/development_secret.txt
237
- - lib/anyt/ext/minitest.rb
238
- - lib/anyt/remote_control.rb
239
- - lib/anyt/rpc.rb
240
- - lib/anyt/tests.rb
241
- - lib/anyt/tests/core/ping_test.rb
242
- - lib/anyt/tests/core/welcome_test.rb
243
- - lib/anyt/tests/features/channel_state_test.rb
244
- - lib/anyt/tests/features/remote_disconnect_test.rb
245
- - lib/anyt/tests/features/server_restart_test.rb
246
- - lib/anyt/tests/request/channel_test.rb
247
- - lib/anyt/tests/request/connection_test.rb
248
- - lib/anyt/tests/request/disconnect_reasons_test.rb
249
- - lib/anyt/tests/request/disconnection_test.rb
250
- - lib/anyt/tests/streams/broadcast_test.rb
251
- - lib/anyt/tests/streams/multiple_clients_test.rb
252
- - lib/anyt/tests/streams/multiple_test.rb
253
- - lib/anyt/tests/streams/single_test.rb
254
- - lib/anyt/tests/streams/stop_test.rb
255
- - lib/anyt/tests/subscriptions/ack_test.rb
256
- - lib/anyt/tests/subscriptions/params_test.rb
257
- - lib/anyt/tests/subscriptions/perform_test.rb
258
- - lib/anyt/tests/subscriptions/transmissions_test.rb
259
- - lib/anyt/utils.rb
260
- - lib/anyt/utils/async_helpers.rb
261
- - lib/anyt/version.rb
262
156
  homepage: http://github.com/anycable/anyt
263
157
  licenses:
264
158
  - MIT
@@ -271,15 +165,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
165
  requirements:
272
166
  - - ">="
273
167
  - !ruby/object:Gem::Version
274
- version: 2.6.0
168
+ version: '0'
275
169
  required_rubygems_version: !ruby/object:Gem::Requirement
276
170
  requirements:
277
171
  - - ">="
278
172
  - !ruby/object:Gem::Version
279
173
  version: '0'
280
174
  requirements: []
281
- rubygems_version: 3.4.8
175
+ rubygems_version: 3.4.20
282
176
  signing_key:
283
177
  specification_version: 4
284
- summary: Anycable conformance testing tool
178
+ summary: Action Cable / AnyCable conformance testing tool
285
179
  test_files: []
data/bin/console DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'anyt'
5
- require 'irb'
6
-
7
- IRB.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/lib/anyt/cli.rb DELETED
@@ -1,194 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "logger"
4
- require "optparse"
5
-
6
- require "anyt/version"
7
- require "anyt/remote_control"
8
- require "anyt/rpc"
9
- require "anyt/command"
10
- require "anyt/tests"
11
-
12
- $stdout.sync = true
13
-
14
- module Anyt
15
- module Cli # :nodoc:
16
- class << self
17
- # CLI entrypoint
18
- def run(args = ARGV)
19
- parse_options!(args)
20
-
21
- ActionCable.server.config.logger = Rails.logger = AnyCable.logger
22
-
23
- result = 1
24
-
25
- $stdout.puts "Starting AnyT v#{Anyt::VERSION} (pid: #{Process.pid})\n"
26
-
27
- begin
28
- # "Enable" AnyCable as early as possible to activate all the features in tests
29
- unless Anyt.config.use_action_cable
30
- ActionCable.server.config.cable = {"adapter" => "any_cable"}
31
- require "anycable-rails"
32
- end
33
-
34
- # Load all test scenarios
35
- Tests.load_tests unless @skip_tests
36
-
37
- Rails.application.initialize!
38
-
39
- # Start RPC server (unless specified otherwise, e.g. when
40
- # we want to test Action Cable itself)
41
- unless @skip_rpc
42
- RPC.start
43
-
44
- if @only_rpc
45
- RPC.server.wait_till_terminated
46
- return
47
- end
48
- end
49
-
50
- # Start webosocket server under test
51
- Command.run
52
-
53
- unless @skip_tests
54
- # Run tests
55
- result = Tests.run ? 0 : 1
56
- end
57
-
58
- wait_till_terminated if @only_rails
59
- rescue Interrupt => e
60
- $stdout.puts "#{e.message}. Good-bye!"
61
- ensure
62
- RPC.stop unless @skip_rpc
63
- Command.stop
64
- end
65
-
66
- result
67
- end
68
-
69
- private
70
-
71
- def parse_options!(args)
72
- parser =
73
- OptionParser.new do |cli|
74
- cli.banner = <<~BANNER
75
- Anyt – AnyCable websocket server conformance tool.
76
-
77
- Usage: anyt [options]
78
-
79
- Options:
80
- BANNER
81
-
82
- cli.on("-cCOMMAND", "--command=COMMAND", "Command to run WS server.") do |command|
83
- Anyt.config.command = command
84
- end
85
-
86
- cli.on("--target-url=TARGET", "URL of target WebSocket server to test.") do |target|
87
- Anyt.config.target_url = target
88
- end
89
-
90
- cli.on("--redis-url=REDIS_URL", "Redis server URL.") do |redis|
91
- AnyCable.config.redis_url = redis
92
- end
93
-
94
- cli.on("--skip-rpc", TrueClass, "Do not run RPC server") do |flag|
95
- @skip_rpc = flag
96
- end
97
-
98
- cli.on("--only-rpc", TrueClass, "Run only RPC server") do |flag|
99
- @only_rpc = flag
100
- end
101
-
102
- cli.on("--only-rails", TrueClass, "Run only Rails server") do
103
- @skip_rpc = true
104
- @only_rails = true
105
- @skip_tests = true
106
-
107
- configure_rails_command!
108
- end
109
-
110
- cli.on("--self-check", "Run tests again Action Cable itself") do
111
- @skip_rpc = true
112
-
113
- configure_rails_command!
114
- end
115
-
116
- cli.on("--only test1,test2,test3", Array, "Run only specified tests") do |only_tests|
117
- Anyt.config.only_tests = only_tests
118
- end
119
-
120
- cli.on("--except test1,test2,test3", Array, "Exclude specified tests") do |except_tests|
121
- Anyt.config.except_tests = except_tests
122
- end
123
-
124
- cli.on("--wait-command=TIMEOUT", Integer,
125
- "Number of seconds to wait for WS server initialization") do |timeout|
126
- Anyt.config.wait_command = timeout
127
- end
128
-
129
- cli.on("--timeout-multiplier=VALUE", Float,
130
- "Default exceptation timeouts multiplier") do |val|
131
- Anyt.config.timeout_multiplier = val
132
- end
133
-
134
- cli.on("-rPATH", "--require=PATH",
135
- "Path to additional tests (e.g. features/*.rb") do |path|
136
- Anyt.config.tests_relative_path = path
137
- ENV["ANYT_TESTS_RELATIVE_PATH"] = path
138
- end
139
-
140
- cli.on("--debug", "Enable debug mode.") do
141
- AnyCable.config.debug = true
142
- end
143
-
144
- cli.on("-h", "--help", "Show this message.") do
145
- puts cli
146
- exit
147
- end
148
-
149
- cli.on("--version", "Print version.") do
150
- puts Anyt::VERSION
151
- exit
152
- end
153
- end
154
-
155
- parser.parse!(args)
156
- rescue OptionParser::InvalidOption => e
157
- unknown_option = e.args.first
158
- puts "This option looks unfamiliar: #{unknown_option}. A typo?"
159
- puts "Use `anyt --help` to list all available options."
160
- exit 1
161
- end
162
-
163
- def configure_rails_command!
164
- dummy_path = ::File.expand_path(
165
- "config.ru",
166
- ::File.join(::File.dirname(__FILE__), "dummy")
167
- )
168
- Anyt.config.command = "bundle exec puma #{dummy_path}"
169
- Anyt.config.use_action_cable = true
170
- end
171
-
172
- def wait_till_terminated
173
- self_read = setup_signals
174
-
175
- while readable_io = IO.select([self_read]) # rubocop:disable Lint/AssignmentInCondition, Lint/IncompatibleIoSelectWithFiberScheduler
176
- signal = readable_io.first[0].gets.strip
177
- raise Interrupt, "SIG#{signal} received"
178
- end
179
- end
180
-
181
- def setup_signals
182
- self_read, self_write = IO.pipe
183
-
184
- %w[INT TERM].each do |signal|
185
- trap signal do
186
- self_write.puts signal
187
- end
188
- end
189
-
190
- self_read
191
- end
192
- end
193
- end
194
- end
data/lib/anyt/client.rb DELETED
@@ -1,112 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Anyt
4
- # Synchronous websocket client
5
- # Based on https://github.com/rails/rails/blob/v5.0.1/actioncable/test/client_test.rb
6
- class Client
7
- require "websocket-client-simple"
8
- require "concurrent"
9
-
10
- class TimeoutError < StandardError; end
11
-
12
- WAIT_WHEN_EXPECTING_EVENT = 5
13
- WAIT_WHEN_NOT_EXPECTING_EVENT = 0.5
14
-
15
- def initialize(
16
- ignore: [], url: Anyt.config.target_url, qs: "",
17
- cookies: "", headers: {},
18
- protocol: "actioncable-v1-json",
19
- timeout_multiplier: Anyt.config.timeout_multiplier
20
- )
21
- ignore_message_types = @ignore_message_types = ignore
22
- messages = @messages = Queue.new
23
- closed = @closed = Concurrent::Event.new
24
- has_messages = @has_messages = Concurrent::Semaphore.new(0)
25
-
26
- @timeout_multiplier = timeout_multiplier
27
-
28
- headers = headers.merge("cookie" => cookies)
29
- headers["Sec-WebSocket-Protocol"] = protocol
30
-
31
- open = Concurrent::Promise.new
32
-
33
- @ws = WebSocket::Client::Simple.connect(
34
- url + "?#{qs}",
35
- headers: headers
36
- ) do |ws|
37
- ws.on(:error) do |event|
38
- event = RuntimeError.new(event.message) unless event.is_a?(Exception)
39
-
40
- if open.pending?
41
- open.fail(event)
42
- else
43
- messages << event
44
- has_messages.release
45
- end
46
- end
47
-
48
- ws.on(:open) do |_event|
49
- open.set(true)
50
- end
51
-
52
- ws.on(:message) do |event|
53
- next if event.type == :ping
54
- if event.type == :close
55
- closed.set
56
- else
57
- message = JSON.parse(event.data)
58
-
59
- next if ignore_message_types.include?(message["type"])
60
-
61
- AnyCable.logger.debug "Message received: #{message}"
62
-
63
- messages << message
64
- has_messages.release
65
- end
66
- end
67
-
68
- ws.on(:close) do |_event|
69
- closed.set
70
- end
71
- end
72
-
73
- open.wait!(WAIT_WHEN_EXPECTING_EVENT * @timeout_multiplier)
74
- end
75
- # rubocop: enable Metrics/BlockLength
76
- # rubocop: enable Metrics/AbcSize
77
- # rubocop: enable Metrics/MethodLength
78
-
79
- def receive(timeout: WAIT_WHEN_EXPECTING_EVENT)
80
- timeout *= @timeout_multiplier
81
-
82
- raise TimeoutError, "Timed out to receive message" unless
83
- @has_messages.try_acquire(1, timeout)
84
-
85
- msg = @messages.pop(true)
86
- raise msg if msg.is_a?(Exception)
87
-
88
- msg
89
- end
90
-
91
- def send(message)
92
- @ws.send(JSON.generate(message))
93
- end
94
-
95
- def close(allow_messages: false)
96
- sleep WAIT_WHEN_NOT_EXPECTING_EVENT * @timeout_multiplier
97
-
98
- raise "#{@messages.size} messages unprocessed" unless allow_messages || @messages.empty?
99
-
100
- @ws.close
101
- wait_for_close
102
- end
103
-
104
- def wait_for_close
105
- @closed.wait(WAIT_WHEN_EXPECTING_EVENT * @timeout_multiplier)
106
- end
107
-
108
- def closed?
109
- @closed.set?
110
- end
111
- end
112
- end
data/lib/anyt/command.rb DELETED
@@ -1,63 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "childprocess"
4
-
5
- module Anyt
6
- # Runs system command (websocket server)
7
- module Command
8
- class << self
9
- def run
10
- return if running?
11
-
12
- return unless Anyt.config.command
13
-
14
- AnyCable.logger.debug "Running command: #{Anyt.config.command}"
15
-
16
- @process = ChildProcess.build(*Anyt.config.command.split(/\s+/))
17
-
18
- process.io.inherit! if AnyCable.config.debug
19
-
20
- process.detach = true
21
-
22
- process.environment["ANYCABLE_DEBUG"] = "1" if AnyCable.config.debug?
23
- process.environment["ANYT_REMOTE_CONTROL_PORT"] = Anyt.config.remote_control_port
24
-
25
- process.start
26
-
27
- AnyCable.logger.debug "Command PID: #{process.pid}"
28
-
29
- sleep Anyt.config.wait_command
30
- raise "Command failed to start" unless running?
31
- end
32
- # rubocop: enable Metrics/MethodLength
33
- # rubocop: enable Metrics/AbcSize
34
-
35
- def restart
36
- return unless running?
37
-
38
- AnyCable.logger.debug "Restarting command PID: #{process.pid}"
39
-
40
- stop
41
- process.wait
42
-
43
- run
44
- end
45
-
46
- def stop
47
- return unless running?
48
-
49
- AnyCable.logger.debug "Terminate PID: #{process.pid}"
50
-
51
- process.stop
52
- end
53
-
54
- def running?
55
- process&.alive?
56
- end
57
-
58
- private
59
-
60
- attr_reader :process
61
- end
62
- end
63
- end
data/lib/anyt/config.rb DELETED
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "anyway"
4
-
5
- module Anyt
6
- # Anyt configuration
7
- class Config < Anyway::Config
8
- attr_config :command,
9
- :only_tests,
10
- :except_tests,
11
- :tests_relative_path,
12
- remote_control_port: 8919,
13
- use_action_cable: false,
14
- target_url: "ws://localhost:9292/cable",
15
- wait_command: 2,
16
- timeout_multiplier: 1
17
-
18
- coerce_types only_tests: {type: :string, array: true}
19
- coerce_types except_tests: {type: :string, array: true}
20
-
21
- def tests_path
22
- return unless tests_relative_path
23
-
24
- File.expand_path(tests_relative_path, Dir.pwd)
25
- end
26
-
27
- def filter_tests?
28
- only_tests || except_tests
29
- end
30
-
31
- def tests_filter
32
- only_rxp = /(#{only_tests.join('|')})/ if only_tests
33
- except_rxp = /(#{except_tests.join('|')})/ if except_tests
34
-
35
- @tests_filter ||= lambda do |path|
36
- (only_rxp.nil? || only_rxp.match?(path)) &&
37
- (except_rxp.nil? || !except_rxp.match?(path))
38
- end
39
- end
40
- end
41
- end