cucumber-html-formatter 20.4.0 → 21.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,88 +5,6 @@
5
5
  * @license MIT
6
6
  */
7
7
 
8
- /*!
9
- * Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com
10
- * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
11
- * Copyright 2022 Fonticons, Inc.
12
- */
13
-
14
- /*!
15
- * elasticlunr.Configuration
16
- * Copyright (C) 2016 Wei Song
17
- */
18
-
19
- /*!
20
- * elasticlunr.DocumentStore
21
- * Copyright (C) 2016 Wei Song
22
- */
23
-
24
- /*!
25
- * elasticlunr.EventEmitter
26
- * Copyright (C) 2016 Oliver Nightingale
27
- * Copyright (C) 2016 Wei Song
28
- */
29
-
30
- /*!
31
- * elasticlunr.Index
32
- * Copyright (C) 2016 Oliver Nightingale
33
- * Copyright (C) 2016 Wei Song
34
- */
35
-
36
- /*!
37
- * elasticlunr.InvertedIndex
38
- * Copyright (C) 2016 Wei Song
39
- * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
40
- */
41
-
42
- /*!
43
- * elasticlunr.Pipeline
44
- * Copyright (C) 2016 Oliver Nightingale
45
- * Copyright (C) 2016 Wei Song
46
- */
47
-
48
- /*!
49
- * elasticlunr.js
50
- * Copyright (C) 2016 Oliver Nightingale
51
- * Copyright (C) 2016 Wei Song
52
- */
53
-
54
- /*!
55
- * elasticlunr.stemmer
56
- * Copyright (C) 2016 Oliver Nightingale
57
- * Copyright (C) 2016 Wei Song
58
- * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
59
- */
60
-
61
- /*!
62
- * elasticlunr.stopWordFilter
63
- * Copyright (C) 2016 Oliver Nightingale
64
- * Copyright (C) 2016 Wei Song
65
- */
66
-
67
- /*!
68
- * elasticlunr.tokenizer
69
- * Copyright (C) 2016 Oliver Nightingale
70
- * Copyright (C) 2016 Wei Song
71
- */
72
-
73
- /*!
74
- * elasticlunr.trimmer
75
- * Copyright (C) 2016 Oliver Nightingale
76
- * Copyright (C) 2016 Wei Song
77
- */
78
-
79
- /*!
80
- * elasticlunr.utils
81
- * Copyright (C) 2016 Oliver Nightingale
82
- * Copyright (C) 2016 Wei Song
83
- */
84
-
85
- /*!
86
- * lunr.SortedSet
87
- * Copyright (C) 2016 Oliver Nightingale
88
- */
89
-
90
8
  /*!
91
9
  * repeat-string <https://github.com/jonschlinkert/repeat-string>
92
10
  *
@@ -139,16 +57,6 @@ and limitations under the License.
139
57
  * LICENSE file in the root directory of this source tree.
140
58
  */
141
59
 
142
- /**
143
- * elasticlunr - http://weixsong.github.io
144
- * Lightweight full-text search engine in Javascript for browser search and offline search. - 0.9.5
145
- *
146
- * Copyright (C) 2016 Oliver Nightingale
147
- * Copyright (C) 2016 Wei Song
148
- * MIT Licensed
149
- * @license
150
- */
151
-
152
60
  /** @license React v17.0.2
153
61
  * react-is.production.min.js
154
62
  *
@@ -1,19 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'optparse'
4
5
  require 'cucumber/messages'
5
6
  require 'cucumber/html_formatter'
6
7
 
7
- formatter = Cucumber::HTMLFormatter::Formatter.new(STDOUT)
8
+ formatter = Cucumber::HTMLFormatter::Formatter.new($stdout)
8
9
 
9
10
  option_parser = OptionParser.new do |opts|
10
- opts.on_tail("-h", "--help", "Show this message") do
11
+ opts.on_tail('-h', '--help', 'Show this message') do
11
12
  puts opts
12
13
  exit
13
14
  end
14
15
  end
15
16
  options = {}
16
17
  option_parser.parse!(into: options)
17
- message_enumerator = Cucumber::Messages::NdjsonToMessageEnumerator.new(STDIN)
18
+ message_enumerator = Cucumber::Messages::NdjsonToMessageEnumerator.new($stdin)
18
19
 
19
20
  formatter.process_messages(message_enumerator)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Cucumber
2
4
  module HTMLFormatter
3
5
  class AssetsLoader
@@ -25,10 +27,9 @@ module Cucumber
25
27
 
26
28
  def html_formatter_path
27
29
  Gem.loaded_specs['cucumber-html-formatter'].full_gem_path
28
- rescue
30
+ rescue StandardError
29
31
  '.'
30
32
  end
31
-
32
33
  end
33
34
  end
34
35
  end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/messages'
4
+ require 'cucumber/html_formatter/template_writer'
5
+ require 'cucumber/html_formatter/assets_loader'
6
+
7
+ module Cucumber
8
+ module HTMLFormatter
9
+ class Formatter
10
+ attr_reader :out
11
+
12
+ def initialize(out)
13
+ @out = out
14
+ @pre_message_written = false
15
+ @first_message = true
16
+ end
17
+
18
+ def process_messages(messages)
19
+ write_pre_message
20
+ messages.each { |message| write_message(message) }
21
+ write_post_message
22
+ end
23
+
24
+ def write_message(message)
25
+ out.puts(',') unless @first_message
26
+ out.print(message.to_json)
27
+
28
+ @first_message = false
29
+ end
30
+
31
+ def write_pre_message
32
+ return if @pre_message_written
33
+
34
+ out.puts(pre_message)
35
+ @pre_message_written = true
36
+ end
37
+
38
+ def write_post_message
39
+ out.print(post_message)
40
+ end
41
+
42
+ private
43
+
44
+ def assets_loader
45
+ @assets_loader ||= AssetsLoader.new
46
+ end
47
+
48
+ def pre_message
49
+ [
50
+ template_writer.write_between(nil, '{{css}}'),
51
+ assets_loader.css,
52
+ template_writer.write_between('{{css}}', '{{messages}}')
53
+ ].join("\n")
54
+ end
55
+
56
+ def post_message
57
+ [
58
+ template_writer.write_between('{{messages}}', '{{script}}'),
59
+ assets_loader.script,
60
+ template_writer.write_between('{{script}}', nil)
61
+ ].join("\n")
62
+ end
63
+
64
+ def template_writer
65
+ @template_writer ||= TemplateWriter.new(assets_loader.template)
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Cucumber
2
4
  module HTMLFormatter
3
5
  class TemplateWriter
@@ -11,9 +13,7 @@ module Cucumber
11
13
  from_exists = !from.nil? && template.include?(from)
12
14
 
13
15
  after_from = from_exists ? template.split(from)[1] : template
14
- before_to = to.nil? ? after_from : after_from.split(to)[0]
15
-
16
- return before_to
16
+ to.nil? ? after_from : after_from.split(to)[0]
17
17
  end
18
18
  end
19
19
  end
@@ -1,69 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cucumber/messages'
2
- require 'cucumber/html_formatter/template_writer'
3
4
  require 'cucumber/html_formatter/assets_loader'
4
-
5
- module Cucumber
6
- module HTMLFormatter
7
- class Formatter
8
- attr_reader :out
9
-
10
- def initialize(out)
11
- @out = out
12
- @pre_message_written = false
13
- @first_message = true
14
- end
15
-
16
- def process_messages(messages)
17
- write_pre_message
18
- messages.each { |message| write_message(message) }
19
- write_post_message
20
- end
21
-
22
- def write_pre_message
23
- return if @pre_message_written
24
-
25
- out.puts(pre_message)
26
- @pre_message_written = true
27
- end
28
-
29
- def write_message(message)
30
- unless @first_message
31
- out.puts(',')
32
- end
33
- out.print(message.to_json)
34
-
35
- @first_message = false
36
- end
37
-
38
- def write_post_message
39
- out.print(post_message)
40
- end
41
-
42
- private
43
-
44
- def assets_loader
45
- @assets_loader ||= AssetsLoader.new
46
- end
47
-
48
- def pre_message
49
- [
50
- template_writer.write_between(nil, '{{css}}'),
51
- assets_loader.css,
52
- template_writer.write_between('{{css}}', '{{messages}}')
53
- ].join("\n")
54
- end
55
-
56
- def post_message
57
- [
58
- template_writer.write_between('{{messages}}', '{{script}}'),
59
- assets_loader.script,
60
- template_writer.write_between('{{script}}', nil)
61
- ].join("\n")
62
- end
63
-
64
- def template_writer
65
- @template_writer ||= TemplateWriter.new(assets_loader.template)
66
- end
67
- end
68
- end
69
- end
5
+ require 'cucumber/html_formatter/formatter'
6
+ require 'cucumber/html_formatter/template_writer'
metadata CHANGED
@@ -1,95 +1,119 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-html-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 20.4.0
4
+ version: 21.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Prêtre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-13 00:00:00.000000000 Z
11
+ date: 2023-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-messages
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '18.0'
19
+ version: '19'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '22.1'
22
+ version: '25'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ">="
27
+ - - ">"
28
28
  - !ruby/object:Gem::Version
29
- version: '18.0'
29
+ version: '19'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '22.1'
32
+ version: '25'
33
33
  - !ruby/object:Gem::Dependency
34
- name: rake
34
+ name: cucumber-compatibility-kit
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '13.0'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 13.0.6
39
+ version: '14.1'
43
40
  type: :development
44
41
  prerelease: false
45
42
  version_requirements: !ruby/object:Gem::Requirement
46
43
  requirements:
47
44
  - - "~>"
48
45
  - !ruby/object:Gem::Version
49
- version: '13.0'
50
- - - ">="
46
+ version: '14.1'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
51
52
  - !ruby/object:Gem::Version
52
- version: 13.0.6
53
+ version: '13.1'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '13.1'
53
61
  - !ruby/object:Gem::Dependency
54
62
  name: rspec
55
63
  requirement: !ruby/object:Gem::Requirement
56
64
  requirements:
57
65
  - - "~>"
58
66
  - !ruby/object:Gem::Version
59
- version: '3.11'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 3.11.0
67
+ version: '3.12'
63
68
  type: :development
64
69
  prerelease: false
65
70
  version_requirements: !ruby/object:Gem::Requirement
66
71
  requirements:
67
72
  - - "~>"
68
73
  - !ruby/object:Gem::Version
69
- version: '3.11'
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 3.11.0
74
+ version: '3.12'
73
75
  - !ruby/object:Gem::Dependency
74
- name: cucumber-compatibility-kit
76
+ name: rubocop
75
77
  requirement: !ruby/object:Gem::Requirement
76
78
  requirements:
77
79
  - - "~>"
78
80
  - !ruby/object:Gem::Version
79
- version: '12.0'
80
- - - ">="
81
+ version: 1.41.0
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: 12.0.0
88
+ version: 1.41.0
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop-rake
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 0.6.0
83
96
  type: :development
84
97
  prerelease: false
85
98
  version_requirements: !ruby/object:Gem::Requirement
86
99
  requirements:
87
100
  - - "~>"
88
101
  - !ruby/object:Gem::Version
89
- version: '12.0'
90
- - - ">="
102
+ version: 0.6.0
103
+ - !ruby/object:Gem::Dependency
104
+ name: rubocop-rspec
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 2.15.0
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
91
115
  - !ruby/object:Gem::Version
92
- version: 12.0.0
116
+ version: 2.15.0
93
117
  description: HTML formatter for Cucumber
94
118
  email: cukes@googlegroups.com
95
119
  executables:
@@ -105,12 +129,8 @@ files:
105
129
  - bin/cucumber-html-formatter
106
130
  - lib/cucumber/html_formatter.rb
107
131
  - lib/cucumber/html_formatter/assets_loader.rb
132
+ - lib/cucumber/html_formatter/formatter.rb
108
133
  - lib/cucumber/html_formatter/template_writer.rb
109
- - spec/acceptance_spec.rb
110
- - spec/capture_warnings.rb
111
- - spec/html-formatter/assets_loader_spec.rb
112
- - spec/html-formatter/template_writer_spec.rb
113
- - spec/html_formatter_spec.rb
114
134
  homepage: https://github.com/cucumber/html-formatter
115
135
  licenses:
116
136
  - MIT
@@ -130,20 +150,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
150
  requirements:
131
151
  - - ">="
132
152
  - !ruby/object:Gem::Version
133
- version: '2.3'
153
+ version: '2.6'
134
154
  required_rubygems_version: !ruby/object:Gem::Requirement
135
155
  requirements:
136
156
  - - ">="
137
157
  - !ruby/object:Gem::Version
138
- version: '0'
158
+ version: 3.0.3
139
159
  requirements: []
140
- rubygems_version: 3.2.33
160
+ rubygems_version: 3.4.10
141
161
  signing_key:
142
162
  specification_version: 4
143
- summary: cucumber-html-formatter-20.4.0
144
- test_files:
145
- - spec/acceptance_spec.rb
146
- - spec/capture_warnings.rb
147
- - spec/html-formatter/assets_loader_spec.rb
148
- - spec/html-formatter/template_writer_spec.rb
149
- - spec/html_formatter_spec.rb
163
+ summary: cucumber-html-formatter-21.2.0
164
+ test_files: []
@@ -1,33 +0,0 @@
1
- require 'cucumber-compatibility-kit'
2
- require 'cucumber/html_formatter'
3
-
4
- describe Cucumber::HTMLFormatter.name do
5
-
6
- Cucumber::CompatibilityKit.gherkin_examples.each do |example_name|
7
- def run_formatter(messages)
8
- out = StringIO.new
9
- formatter = Cucumber::HTMLFormatter::Formatter.new(out)
10
- formatter.process_messages(messages)
11
- out.string
12
- end
13
-
14
- describe "'#{example_name}' example" do
15
- subject(:html_report) { run_formatter(File.readlines(example_ndjson)) }
16
-
17
- let(:example_ndjson) { "#{Cucumber::CompatibilityKit.example_path(example_name)}/#{example_name}.feature.ndjson" }
18
-
19
- it { is_expected.to match(/\A<!DOCTYPE html>\s?<html/) }
20
- it { is_expected.to match(/<\/html>\Z/) }
21
- end
22
- end
23
-
24
- Cucumber::CompatibilityKit.markdown_examples.each do |example_name|
25
- describe "'#{example_name}' example" do
26
- let(:example_ndjson) { "#{Cucumber::CompatibilityKit.example_path(example_name)}/#{example_name}.feature.md.ndjson" }
27
- subject(:html_report) { run_formatter(File.readlines(example_ndjson)) }
28
-
29
- it { is_expected.to match(/\A<!DOCTYPE html>\s?<html/) }
30
- it { is_expected.to match(/<\/html>\Z/) }
31
- end
32
- end
33
- end
@@ -1,74 +0,0 @@
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
@@ -1,30 +0,0 @@
1
- require 'cucumber/html_formatter/assets_loader'
2
-
3
- describe Cucumber::HTMLFormatter::AssetsLoader do
4
- let(:subject) { Cucumber::HTMLFormatter::AssetsLoader.new }
5
-
6
- before do
7
- allow(File).to receive(:read).and_return('whatever content')
8
- end
9
-
10
- context '.template' do
11
- it 'reads the content of assets/index.mustache.html' do
12
- expect(subject.template).to eq('whatever content')
13
- expect(File).to have_received(:read).with(/.*\/assets\/index\.mustache\.html$/)
14
- end
15
- end
16
-
17
- context '.css' do
18
- it 'reads the content of assets/main.css' do
19
- expect(subject.css).to eq('whatever content')
20
- expect(File).to have_received(:read).with(/.*\/assets\/main\.css$/)
21
- end
22
- end
23
-
24
- context '.script' do
25
- it 'reads the content of assets/main.js' do
26
- expect(subject.script).to eq('whatever content')
27
- expect(File).to have_received(:read).with(/.*\/assets\/main\.js$/)
28
- end
29
- end
30
- end
@@ -1,30 +0,0 @@
1
- require 'cucumber/html_formatter/template_writer'
2
-
3
- describe Cucumber::HTMLFormatter::TemplateWriter do
4
- context 'write_between' do
5
- let(:subject) { writer = Cucumber::HTMLFormatter::TemplateWriter.new(template) }
6
- let(:template) { 'Some template {{here}} with content after' }
7
-
8
- it 'outputs content of the template between the given words' do
9
- expect(subject.write_between('Some', 'content')).to eq(' template {{here}} with ')
10
- end
11
-
12
- context 'when "from" argument is nil' do
13
- it 'outputs template from the beginning' do
14
- expect(subject.write_between(nil, '{{here}}')).to eq('Some template ')
15
- end
16
- end
17
-
18
- context 'when "to" argument is nil' do
19
- it 'outputs content of template after the "from" argument value' do
20
- expect(subject.write_between('{{here}}', nil)).to eq(' with content after')
21
- end
22
- end
23
-
24
- context 'when "from" argument is missing from the template' do
25
- it 'renders the template from the beginning' do
26
- expect(subject.write_between('Unknown start', '{{here}}')).to eq('Some template ')
27
- end
28
- end
29
- end
30
- end