minitest-reporters-ws 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzQxNTg3OTI5OTgzY2FmNTk2ODk5ZjEyYmQ1ZjI2ZGIyNzU0MDhkZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTIwNzVjMDJmZjViMjljZGYwNTIzNDllODM4Yjg0NjBlNTAwMDM2NA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2VlYThjOTA2MTdkZmE2ZDBhNTEzODg3Nzk4MTExYTZhZGU3NTQzMGQ0Mzgz
|
10
|
+
NzlmZWI1YzYwN2JhMTBmMGM0MWM0MWJjMDIzOGY4YWVlNjIyNmNlODY1OGZh
|
11
|
+
MGI4YmMxZjcyYTljYTJjMjUwOGYxNzBmOGIxYTgyN2I2MTJiYjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGEwYjgyZjZiYzMyZTNkMjM1OGYyZmUyYzU0MmI0MmY5ZDg2YjE3MThiMzky
|
14
|
+
MzJmYTU3NWY3OTFlNmEwNDI2MmJkM2U0YmM5M2ZkMzI3NzBjZmRhM2YyZTdm
|
15
|
+
OGU0NDZiYmNkNDU4YmQ2MzI0MWMwNDg0ZjVmMGJjN2Q4MjAzNTE=
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Minitest::Reporters::Ws
|
|
4
4
|
The Minitest Formatter is working, but I need to work with the
|
5
5
|
sinatra app to change the formatting of the results.
|
6
6
|
|
7
|
+
> If you want to use it with Zeus, check out that branch
|
8
|
+
|
7
9
|
### Minitest Websocket Reporter
|
8
10
|
|
9
11
|
> ala https://github.com/RyanScottLewis/rspec-web
|
@@ -9,16 +9,21 @@ module Minitest::Reporters::Ws
|
|
9
9
|
def initialize(opts = {})
|
10
10
|
init_config(opts.delete(:yml), opts.delete(:config), opts.delete(:env))
|
11
11
|
init_socket
|
12
|
-
|
12
|
+
rescue => ex
|
13
|
+
puts ex.message
|
13
14
|
end
|
14
15
|
|
15
16
|
def identify
|
16
17
|
data = { receiver: "server", method: "identify", arguments: ["rspec"] }
|
17
18
|
@socket.send(data.to_json) if connected?
|
19
|
+
#rescue => ex
|
20
|
+
# puts ex.message
|
18
21
|
end
|
19
22
|
|
20
23
|
def send_msg(data)
|
21
24
|
@socket.send(data.to_json) if connected?
|
25
|
+
#rescue => ex
|
26
|
+
# puts ex.message
|
22
27
|
end
|
23
28
|
|
24
29
|
def close
|
@@ -26,6 +31,8 @@ module Minitest::Reporters::Ws
|
|
26
31
|
data = { receiver: "server", method: "disconnect", arguments: ["rspec"] }
|
27
32
|
@socket.send(data.to_json) if connected?
|
28
33
|
@socket.close if connected?
|
34
|
+
#rescue => ex
|
35
|
+
# puts ex.message
|
29
36
|
end
|
30
37
|
|
31
38
|
def connected?
|
@@ -38,9 +45,9 @@ module Minitest::Reporters::Ws
|
|
38
45
|
@timestamp = Time.now.to_i
|
39
46
|
@socket = begin
|
40
47
|
WebSocket.new("ws://localhost:10081")
|
41
|
-
rescue => ex
|
42
|
-
|
43
|
-
|
48
|
+
#rescue => ex
|
49
|
+
# puts ex.message
|
50
|
+
# nil
|
44
51
|
end
|
45
52
|
end
|
46
53
|
|
@@ -10,24 +10,24 @@ module Minitest::Reporters::Ws
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def start_new_iteration(test_count = 420)
|
13
|
-
|
13
|
+
client.send_msg(messages[:start_new_iteration].merge arguments: [@timestamp, test_count])
|
14
14
|
end
|
15
15
|
|
16
16
|
def add_to_passing(test)
|
17
|
-
|
17
|
+
client.send_msg(prep_result(test, :add_to_passing))
|
18
18
|
end
|
19
19
|
|
20
20
|
def add_to_pending(test)
|
21
|
-
|
21
|
+
client.send_msg(prep_result(test, :add_to_pending))
|
22
22
|
end
|
23
23
|
|
24
24
|
def add_to_failing(test)
|
25
|
-
|
25
|
+
client.send_msg(prep_result(test, :add_to_failing))
|
26
26
|
end
|
27
27
|
|
28
28
|
def add_to_erring(test)
|
29
29
|
# for now, treating erring the same as failing
|
30
|
-
|
30
|
+
client.send_msg(prep_result(test, :add_to_erring))
|
31
31
|
end
|
32
32
|
|
33
33
|
private
|
@@ -17,35 +17,39 @@ module Minitest::Reporters::Ws
|
|
17
17
|
attr_accessor :timestamp
|
18
18
|
attr_accessor :client
|
19
19
|
attr_accessor :metadata
|
20
|
+
attr_accessor :test_count
|
20
21
|
|
21
22
|
# MUTEX on MiniTest::ReporterRunner?
|
22
23
|
|
23
24
|
def initialize(opts = {})
|
25
|
+
|
26
|
+
@config = conf = ::Minitest::Reporters::Ws::Client::DEFAULT_CONFIG
|
24
27
|
@emoji = EMOJI.merge(opts.fetch(:emoji, {}))
|
25
28
|
|
26
29
|
init_counts
|
27
30
|
init_suite_counts
|
28
|
-
init_client
|
29
|
-
set_timestamp
|
30
31
|
end
|
31
32
|
|
32
33
|
def init_client
|
33
|
-
|
34
|
-
find_or_create_client(conf)
|
34
|
+
client
|
35
|
+
#find_or_create_client(conf)
|
35
36
|
end
|
36
37
|
|
37
38
|
# MINITEST HOOKS
|
38
39
|
|
39
40
|
def before_suites(suite, type)
|
41
|
+
init_client
|
42
|
+
set_timestamp
|
40
43
|
set_metadata
|
41
|
-
start_new_iteration(metadata[:test_count])
|
42
44
|
init_suite_counts
|
43
|
-
|
45
|
+
client.identify
|
46
|
+
total_tests = metadata[:test_count]
|
47
|
+
start_new_iteration(total_tests) if total_tests > 0
|
44
48
|
end
|
45
49
|
|
46
50
|
def after_suites(suites, type)
|
47
51
|
print_after_suites
|
48
|
-
|
52
|
+
client.close
|
49
53
|
end
|
50
54
|
|
51
55
|
def before_suite(suite)
|
@@ -60,11 +64,7 @@ module Minitest::Reporters::Ws
|
|
60
64
|
end
|
61
65
|
|
62
66
|
def before_test(suite,test)
|
63
|
-
#
|
64
|
-
# on the second run,
|
65
|
-
# these are still nil,
|
66
|
-
# for some reason
|
67
|
-
# oh i wish i knew why!
|
67
|
+
# need to move towards using metadata[:test_count], etc
|
68
68
|
@test_count ||= 0
|
69
69
|
@suite_test_count ||= 0
|
70
70
|
end
|
@@ -100,30 +100,41 @@ module Minitest::Reporters::Ws
|
|
100
100
|
add_to_erring(to_metadata(runner, test_runner))
|
101
101
|
end
|
102
102
|
|
103
|
+
attr_accessor(:client)
|
104
|
+
def client
|
105
|
+
# when running in zeus, client becomes nil?
|
106
|
+
@client ||= ::Minitest::Reporters::Ws::Client.new(config: @config)
|
107
|
+
end
|
108
|
+
|
109
|
+
#def find_or_create_client
|
110
|
+
#client = ::Minitest::Reporters::Ws::Client.new(config: config)
|
111
|
+
#set_global_client(::Minitest::Reporters::Ws::Client.new(config: config))
|
112
|
+
# if global_client? && global_client
|
113
|
+
# global_client
|
114
|
+
#else
|
115
|
+
# set_global_client(::Minitest::Reporters::Ws::Client.new(config: config))
|
116
|
+
#end
|
117
|
+
#end
|
118
|
+
|
103
119
|
# wanted this to be defined as a module accessor,
|
104
120
|
# so zeus will create the initial client
|
105
121
|
# when it initially loads up the minitest_helper
|
106
122
|
# then subsequent test runs will use the same client
|
107
123
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
global_client
|
123
|
-
else
|
124
|
-
::Minitest::Reporters::Ws::Client.new(config: config)
|
125
|
-
end
|
126
|
-
end
|
124
|
+
# but... did the opposite of what i thought,
|
125
|
+
# there are still a few issues with zeus
|
126
|
+
|
127
|
+
#def global_client
|
128
|
+
# ::Minitest::Reporters::Ws.class_variable_get("@@client")
|
129
|
+
#end
|
130
|
+
#
|
131
|
+
#def set_global_client(c)
|
132
|
+
# ::Minitest::Reporters::Ws.class_variable_set("@@client", c)
|
133
|
+
#end
|
134
|
+
#
|
135
|
+
#def global_client?
|
136
|
+
# ::Minitest::Reporters::Ws.class_variable_defined?("@@client")
|
137
|
+
#end
|
127
138
|
|
128
139
|
private
|
129
140
|
|