cucumber-formatter-dots 1.0.3
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 +7 -0
- data/LICENSE +21 -0
- data/lib/cucumber/formatter/dots.rb +49 -0
- data/spec/capture_warnings.rb +74 -0
- data/spec/coverage.rb +7 -0
- data/spec/cucumber/formatter/dots_spec.rb +48 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6d21ef3f4ed20a70d8f033ca6eb6657525097c6e40568b2b8f96a052113b3441
|
4
|
+
data.tar.gz: 072e1f580f80c739646a71af6f95f6d4aeeda816b6824fd7609adf2002146296
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e92991ba30d7b703fa1482aa6f6bc6310ea6b6b69eb9db11339e84714e91559f1f14b48e3f37fd3abd78deda5f3e384e1c3757711a639ec390cee264eb288b39
|
7
|
+
data.tar.gz: c18fb98ad03afbab62a6d02ab29f908d47404780465b1c661911db10d52736dd3c4e9812cd5436ccd4eefbaac0f5eec905b01bbad492cc0261aeca81ffebe38d
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) Cucumber Ltd
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require 'cucumber/messages'
|
3
|
+
require 'c21e/exe_file'
|
4
|
+
|
5
|
+
module Cucumber
|
6
|
+
module Formatter
|
7
|
+
|
8
|
+
class Dots
|
9
|
+
include ::Cucumber::Messages::Varint
|
10
|
+
|
11
|
+
def initialize(config)
|
12
|
+
@out_stream = config.out_stream
|
13
|
+
|
14
|
+
config.on_event :test_run_started, &method(:on_test_run_started)
|
15
|
+
config.on_event :test_step_finished, &method(:on_test_step_finished)
|
16
|
+
config.on_event :test_run_finished, &method(:on_test_run_finished)
|
17
|
+
|
18
|
+
root = File.expand_path(File.dirname(__FILE__) + '/../../..')
|
19
|
+
@exe = C21e::ExeFile.new("#{root}/dots-formatter-go/dots-formatter-go-{{.OS}}-{{.Arch}}{{.Ext}}").target_file
|
20
|
+
end
|
21
|
+
|
22
|
+
def on_test_run_started(event)
|
23
|
+
@stdin, stdout, stderr, @wait_thread = Open3.popen3(@exe)
|
24
|
+
@out_thread = Thread.new do
|
25
|
+
stdout.each_byte {|b| @out_stream << b.chr}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def on_test_step_finished(event)
|
30
|
+
wrapper = Cucumber::Messages::Wrapper.new(
|
31
|
+
testStepFinished: Cucumber::Messages::TestStepFinished.new(
|
32
|
+
testResult: Cucumber::Messages::TestResult.new(
|
33
|
+
status: event.result.to_sym.upcase
|
34
|
+
)
|
35
|
+
)
|
36
|
+
)
|
37
|
+
bytes = Cucumber::Messages::Wrapper.encode(wrapper)
|
38
|
+
encode_varint(@stdin, bytes.unpack('C*').length)
|
39
|
+
@stdin.write(bytes)
|
40
|
+
end
|
41
|
+
|
42
|
+
def on_test_run_finished(event)
|
43
|
+
@stdin.close
|
44
|
+
@wait_thread.join
|
45
|
+
@out_thread.join
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# With thanks to @myronmarston
|
3
|
+
# https://github.com/vcr/vcr/blob/master/spec/capture_warnings.rb
|
4
|
+
|
5
|
+
module CaptureWarnings
|
6
|
+
def report_warnings(&block)
|
7
|
+
current_dir = Dir.pwd
|
8
|
+
warnings, errors = capture_error(&block).partition { |line| line.include?('warning') }
|
9
|
+
project_warnings, other_warnings = warnings.uniq.partition { |line| line.include?(current_dir) }
|
10
|
+
|
11
|
+
if errors.any?
|
12
|
+
puts errors.join("\n")
|
13
|
+
end
|
14
|
+
|
15
|
+
if other_warnings.any?
|
16
|
+
puts "#{ other_warnings.count } warnings detected, set VIEW_OTHER_WARNINGS=true to see them."
|
17
|
+
print_warnings('other', other_warnings) if ENV['VIEW_OTHER_WARNINGS']
|
18
|
+
end
|
19
|
+
|
20
|
+
# Until they fix https://bugs.ruby-lang.org/issues/10661
|
21
|
+
if RUBY_VERSION == "2.2.0"
|
22
|
+
project_warnings = project_warnings.reject { |w| w =~ /warning: possible reference to past scope/ }
|
23
|
+
end
|
24
|
+
|
25
|
+
if project_warnings.any?
|
26
|
+
puts "#{ project_warnings.count } warnings detected"
|
27
|
+
print_warnings('cucumber-expressions', project_warnings)
|
28
|
+
fail "Please remove all cucumber-expressions warnings."
|
29
|
+
end
|
30
|
+
|
31
|
+
ensure_system_exit_if_required
|
32
|
+
end
|
33
|
+
|
34
|
+
def capture_error(&block)
|
35
|
+
old_stderr = STDERR.clone
|
36
|
+
pipe_r, pipe_w = IO.pipe
|
37
|
+
pipe_r.sync = true
|
38
|
+
error = String.new
|
39
|
+
reader = Thread.new do
|
40
|
+
begin
|
41
|
+
loop do
|
42
|
+
error << pipe_r.readpartial(1024)
|
43
|
+
end
|
44
|
+
rescue EOFError
|
45
|
+
end
|
46
|
+
end
|
47
|
+
STDERR.reopen(pipe_w)
|
48
|
+
block.call
|
49
|
+
ensure
|
50
|
+
capture_system_exit
|
51
|
+
STDERR.reopen(old_stderr)
|
52
|
+
pipe_w.close
|
53
|
+
reader.join
|
54
|
+
return error.split("\n")
|
55
|
+
end
|
56
|
+
|
57
|
+
def print_warnings(type, warnings)
|
58
|
+
puts
|
59
|
+
puts "-" * 30 + " #{type} warnings: " + "-" * 30
|
60
|
+
puts
|
61
|
+
puts warnings.join("\n")
|
62
|
+
puts
|
63
|
+
puts "-" * 75
|
64
|
+
puts
|
65
|
+
end
|
66
|
+
|
67
|
+
def ensure_system_exit_if_required
|
68
|
+
raise @system_exit if @system_exit
|
69
|
+
end
|
70
|
+
|
71
|
+
def capture_system_exit
|
72
|
+
@system_exit = $!
|
73
|
+
end
|
74
|
+
end
|
data/spec/coverage.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
require 'cucumber/formatter/dots'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
module Formatter
|
6
|
+
|
7
|
+
class StubConfig
|
8
|
+
attr_reader :out_stream
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@out_stream = StringIO.new
|
12
|
+
@handlers = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def on_event(event, &handler)
|
16
|
+
@handlers[event] = handler
|
17
|
+
end
|
18
|
+
|
19
|
+
def method_missing(sym, *args)
|
20
|
+
@handlers[sym].call(*args)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
TestStepFinished = Struct.new(:result)
|
25
|
+
|
26
|
+
describe Dots do
|
27
|
+
it 'prints coloured dots' do
|
28
|
+
config = StubConfig.new
|
29
|
+
f = Dots.new(config)
|
30
|
+
|
31
|
+
config.test_run_started({})
|
32
|
+
config.test_step_finished(TestStepFinished.new('failed'))
|
33
|
+
config.test_step_finished(TestStepFinished.new('skipped'))
|
34
|
+
config.test_step_finished(TestStepFinished.new('undefined'))
|
35
|
+
config.test_step_finished(TestStepFinished.new('ambiguous'))
|
36
|
+
config.test_step_finished(TestStepFinished.new('passed'))
|
37
|
+
config.test_step_finished(TestStepFinished.new('pending'))
|
38
|
+
config.test_run_finished({})
|
39
|
+
|
40
|
+
config.out_stream.rewind
|
41
|
+
out = config.out_stream.read
|
42
|
+
|
43
|
+
# F-UA.P in colours
|
44
|
+
expect(out).to eq("\e[31mF\e[0m\e[36m-\e[0m\e[33mU\e[0m\e[35mA\e[0m\e[32m.\e[0m\e[33mP\e[0m\n")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cucumber-formatter-dots
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Wynne
|
8
|
+
- Aslak Hellesøy
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2018-09-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.5'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.5'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.7'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '3.7'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: cucumber-messages
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: os
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
description: Dots formatter for cucumber
|
85
|
+
email: cukes@googlegroups.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- LICENSE
|
91
|
+
- lib/cucumber/formatter/dots.rb
|
92
|
+
- spec/capture_warnings.rb
|
93
|
+
- spec/coverage.rb
|
94
|
+
- spec/cucumber/formatter/dots_spec.rb
|
95
|
+
homepage: https://github.com/cucumber/dots-formatter-ruby
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options:
|
101
|
+
- "--charset=UTF-8"
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 1.9.3
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.7.7
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: cucumber-formatter-dots-1.0.3
|
120
|
+
test_files:
|
121
|
+
- spec/capture_warnings.rb
|
122
|
+
- spec/coverage.rb
|
123
|
+
- spec/cucumber/formatter/dots_spec.rb
|