cucumber-html-formatter 21.1.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
  *
@@ -5,7 +5,7 @@ require 'optparse'
5
5
  require 'cucumber/messages'
6
6
  require 'cucumber/html_formatter'
7
7
 
8
- formatter = Cucumber::HTMLFormatter::Formatter.new(STDOUT)
8
+ formatter = Cucumber::HTMLFormatter::Formatter.new($stdout)
9
9
 
10
10
  option_parser = OptionParser.new do |opts|
11
11
  opts.on_tail('-h', '--help', 'Show this message') do
@@ -15,6 +15,6 @@ option_parser = OptionParser.new do |opts|
15
15
  end
16
16
  options = {}
17
17
  option_parser.parse!(into: options)
18
- message_enumerator = Cucumber::Messages::NdjsonToMessageEnumerator.new(STDIN)
18
+ message_enumerator = Cucumber::Messages::NdjsonToMessageEnumerator.new($stdin)
19
19
 
20
20
  formatter.process_messages(message_enumerator)
@@ -27,7 +27,7 @@ module Cucumber
27
27
 
28
28
  def html_formatter_path
29
29
  Gem.loaded_specs['cucumber-html-formatter'].full_gem_path
30
- rescue
30
+ rescue StandardError
31
31
  '.'
32
32
  end
33
33
  end
@@ -22,9 +22,7 @@ module Cucumber
22
22
  end
23
23
 
24
24
  def write_message(message)
25
- unless @first_message
26
- out.puts(',')
27
- end
25
+ out.puts(',') unless @first_message
28
26
  out.print(message.to_json)
29
27
 
30
28
  @first_message = false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-html-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 21.1.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-12-12 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
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '25'
33
+ - !ruby/object:Gem::Dependency
34
+ name: cucumber-compatibility-kit
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '14.1'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '14.1'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: rake
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -59,33 +73,33 @@ dependencies:
59
73
  - !ruby/object:Gem::Version
60
74
  version: '3.12'
61
75
  - !ruby/object:Gem::Dependency
62
- name: cucumber-compatibility-kit
76
+ name: rubocop
63
77
  requirement: !ruby/object:Gem::Requirement
64
78
  requirements:
65
79
  - - "~>"
66
80
  - !ruby/object:Gem::Version
67
- version: '14.1'
81
+ version: 1.41.0
68
82
  type: :development
69
83
  prerelease: false
70
84
  version_requirements: !ruby/object:Gem::Requirement
71
85
  requirements:
72
86
  - - "~>"
73
87
  - !ruby/object:Gem::Version
74
- version: '14.1'
88
+ version: 1.41.0
75
89
  - !ruby/object:Gem::Dependency
76
- name: rubocop
90
+ name: rubocop-rake
77
91
  requirement: !ruby/object:Gem::Requirement
78
92
  requirements:
79
93
  - - "~>"
80
94
  - !ruby/object:Gem::Version
81
- version: 1.41.0
95
+ version: 0.6.0
82
96
  type: :development
83
97
  prerelease: false
84
98
  version_requirements: !ruby/object:Gem::Requirement
85
99
  requirements:
86
100
  - - "~>"
87
101
  - !ruby/object:Gem::Version
88
- version: 1.41.0
102
+ version: 0.6.0
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: rubocop-rspec
91
105
  requirement: !ruby/object:Gem::Requirement
@@ -117,11 +131,6 @@ files:
117
131
  - lib/cucumber/html_formatter/assets_loader.rb
118
132
  - lib/cucumber/html_formatter/formatter.rb
119
133
  - lib/cucumber/html_formatter/template_writer.rb
120
- - spec/acceptance_spec.rb
121
- - spec/html_formatter/assets_loader_spec.rb
122
- - spec/html_formatter/formatter_spec.rb
123
- - spec/html_formatter/template_writer_spec.rb
124
- - spec/spec_helper.rb
125
134
  homepage: https://github.com/cucumber/html-formatter
126
135
  licenses:
127
136
  - MIT
@@ -151,10 +160,5 @@ requirements: []
151
160
  rubygems_version: 3.4.10
152
161
  signing_key:
153
162
  specification_version: 4
154
- summary: cucumber-html-formatter-21.1.0
155
- test_files:
156
- - spec/acceptance_spec.rb
157
- - spec/html_formatter/assets_loader_spec.rb
158
- - spec/html_formatter/formatter_spec.rb
159
- - spec/html_formatter/template_writer_spec.rb
160
- - spec/spec_helper.rb
163
+ summary: cucumber-html-formatter-21.2.0
164
+ test_files: []
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cucumber-compatibility-kit'
4
-
5
- describe Cucumber::HTMLFormatter.name do
6
-
7
- Cucumber::CompatibilityKit.gherkin_examples.each do |example_name|
8
- def run_formatter(messages)
9
- out = StringIO.new
10
- formatter = Cucumber::HTMLFormatter::Formatter.new(out)
11
- formatter.process_messages(messages)
12
- out.string
13
- end
14
-
15
- describe "'#{example_name}' example" do
16
- subject(:html_report) { run_formatter(File.readlines(example_ndjson)) }
17
-
18
- let(:example_ndjson) { "#{Cucumber::CompatibilityKit.example_path(example_name)}/#{example_name}.feature.ndjson" }
19
-
20
- it { is_expected.to match(/\A<!DOCTYPE html>\s?<html/) }
21
- it { is_expected.to match(/<\/html>\Z/) }
22
- end
23
- end
24
-
25
- Cucumber::CompatibilityKit.markdown_examples.each do |example_name|
26
- describe "'#{example_name}' example" do
27
- let(:example_ndjson) { "#{Cucumber::CompatibilityKit.example_path(example_name)}/#{example_name}.feature.md.ndjson" }
28
- subject(:html_report) { run_formatter(File.readlines(example_ndjson)) }
29
-
30
- it { is_expected.to match(/\A<!DOCTYPE html>\s?<html/) }
31
- it { is_expected.to match(/<\/html>\Z/) }
32
- end
33
- end
34
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Cucumber::HTMLFormatter::AssetsLoader do
4
- subject(:assets_loader) { described_class.new }
5
-
6
- before do
7
- allow(File).to receive(:read).and_return('whatever content')
8
- end
9
-
10
- describe '#template' do
11
- it 'reads the content of assets/index.mustache.html' do
12
- expect(File).to receive(:read).with(/.*\/assets\/index\.mustache\.html$/)
13
-
14
- assets_loader.template
15
- end
16
- end
17
-
18
- describe '#css' do
19
- it 'reads the content of assets/main.css' do
20
- expect(File).to receive(:read).with(/.*\/assets\/main\.css$/)
21
-
22
- assets_loader.css
23
- end
24
- end
25
-
26
- describe '#script' do
27
- it 'reads the content of assets/main.js' do
28
- expect(File).to receive(:read).with(/.*\/assets\/main\.js$/)
29
-
30
- assets_loader.script
31
- end
32
- end
33
- end
@@ -1,87 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cucumber/messages'
4
-
5
- describe Cucumber::HTMLFormatter::Formatter do
6
- subject(:formatter) do
7
- formatter = Cucumber::HTMLFormatter::Formatter.new(out)
8
- allow(formatter).to receive(:assets_loader).and_return(assets)
9
- formatter
10
- end
11
-
12
- let(:out) { StringIO.new }
13
- let(:fake_assets) do
14
- Class.new do
15
- def template
16
- '<html>{{css}}<body>{{messages}}</body>{{script}}</html>'
17
- end
18
-
19
- def css
20
- '<style>div { color: red }</style>'
21
- end
22
-
23
- def script
24
- "<script>alert('Hi')</script>"
25
- end
26
- end
27
- end
28
- let(:assets) { fake_assets.new }
29
-
30
- describe '#process_messages' do
31
- let(:message) { Cucumber::Messages::Envelope.new(pickle: Cucumber::Messages::Pickle.new(id: 'some-random-uid')) }
32
-
33
- it 'produces the full html report' do
34
- formatter.process_messages([message])
35
- expect(out.string).to eq(
36
- [
37
- '<html>',
38
- '<style>div { color: red }</style>',
39
- '<body>',
40
- "#{message.to_json}</body>",
41
- "<script>alert('Hi')</script>",
42
- '</html>'
43
- ].join("\n")
44
- )
45
- end
46
- end
47
-
48
- describe '#write_pre_message' do
49
- it 'outputs the content of the template up to {{messages}}' do
50
- formatter.write_pre_message
51
-
52
- expect(out.string).to eq("<html>\n<style>div { color: red }</style>\n<body>\n")
53
- end
54
-
55
- it 'does not write the content twice' do
56
- formatter.write_pre_message
57
- formatter.write_pre_message
58
-
59
- expect(out.string).to eq("<html>\n<style>div { color: red }</style>\n<body>\n")
60
- end
61
- end
62
-
63
- describe '#write_message' do
64
- let(:message) { Cucumber::Messages::Envelope.new(pickle: Cucumber::Messages::Pickle.new(id: 'some-random-uid')) }
65
-
66
- it 'appends the message to out' do
67
- formatter.write_message(message)
68
-
69
- expect(out.string).to eq(message.to_json)
70
- end
71
-
72
- it 'adds commas between the messages' do
73
- formatter.write_message(message)
74
- formatter.write_message(message)
75
-
76
- expect(out.string).to eq("#{message.to_json},\n#{message.to_json}")
77
- end
78
- end
79
-
80
- describe '#write_post_message' do
81
- it 'outputs the template end' do
82
- formatter.write_post_message
83
-
84
- expect(out.string).to eq("</body>\n<script>alert('Hi')</script>\n</html>")
85
- end
86
- end
87
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Cucumber::HTMLFormatter::TemplateWriter do
4
- describe '#write_between' do
5
- subject(:template_writer) { described_class.new(template) }
6
-
7
- let(:template) { 'Some template {{here}} with content after' }
8
-
9
- it 'outputs content of the template between the given words' do
10
- expect(template_writer.write_between('Some', 'content')).to eq(' template {{here}} with ')
11
- end
12
-
13
- context 'when the `from` argument is `nil`' do
14
- it 'outputs template from the beginning' do
15
- expect(template_writer.write_between(nil, '{{here}}')).to eq('Some template ')
16
- end
17
- end
18
-
19
- context 'when the `to` argument is `nil`' do
20
- it 'outputs content of template after the "from" argument value' do
21
- expect(template_writer.write_between('{{here}}', nil)).to eq(' with content after')
22
- end
23
- end
24
-
25
- context 'when the `from` argument is not contained in the template' do
26
- it 'renders the template from the beginning' do
27
- expect(template_writer.write_between('Unknown start', '{{here}}')).to eq('Some template ')
28
- end
29
- end
30
- end
31
- end
data/spec/spec_helper.rb DELETED
@@ -1 +0,0 @@
1
- require 'cucumber/html_formatter'