semaphore_test_boosters 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5730d36677a1460fe1976df22ef5dba8066e338c
4
- data.tar.gz: 00d189933e4301d030d07e89057f9d1546cc3d75
3
+ metadata.gz: b213f22e0bcbf7f6ff0ed6313e07e938671df73f
4
+ data.tar.gz: f2391b3857a2ee76f50c384a39c5d3080e7d5ada
5
5
  SHA512:
6
- metadata.gz: c04de98162295c5a6c91e249b0327ed337e2b7d28456e8ea35a6af05042e44c83b724e875a04701027ab13f2bcf88ed99bcaf66d880f18792f80c88e76ebb34e
7
- data.tar.gz: 86d52b3ec437cc3b0aa6ccd414d11ace058422f2b3ff9e1f554844b88e94c1929e5165b1b2295b027b980faba831295ff1e1ad4317c81991ca2f26c0879fdf1d
6
+ metadata.gz: e59a27970000c05f7adc55b7caeb05d9a5a1b544faa7c4d466daaa60856309842efa2dc8448af4867cad736b1c3a3887f57134221080d9c2a54247c97b528cc8
7
+ data.tar.gz: c6e6fe67907fe336d5edbe845725a8e0ec3be79baafe7e23473f57a0e8001533a1d010b656684f9bd755c4282710cc353f07f9c661d33c3c782c37ab7c05385c
data/.rubocop.yml CHANGED
@@ -10,6 +10,7 @@ AllCops:
10
10
  - "lib/test_boosters/cucumber_booster.rb"
11
11
  - "test_data_pass/**/*"
12
12
  - "test_data_fail/**/*"
13
+ - "rspec_formatters/semaphore_rspec3_json_formatter.rb"
13
14
 
14
15
  Style/StringLiterals:
15
16
  EnforcedStyle: double_quotes
data/README.md CHANGED
@@ -200,6 +200,13 @@ Under the hood, the Go Test Booster uses the following command:
200
200
  go test <file_list>
201
201
  ```
202
202
 
203
+ ## Development
204
+
205
+ ### Integration testing
206
+
207
+ For integration tests we use test repositories that are located in
208
+ <https://github.com/renderedtext/test-boosters-tests.git>.
209
+
203
210
  ## Contributing
204
211
 
205
212
  Bug reports and pull requests are welcome on GitHub at
@@ -25,7 +25,8 @@ module TestBoosters
25
25
  end
26
26
 
27
27
  def rspec_options
28
- @rspec_options ||= "#{ENV["TB_RSPEC_OPTIONS"]} --format documentation --format json --out #{report_path}"
28
+ # rubocop:disable LineLength
29
+ @rspec_options ||= "#{ENV["TB_RSPEC_OPTIONS"]} --format documentation --require #{formatter_path} --format SemaphoreFormatter --out #{report_path}"
29
30
  end
30
31
 
31
32
  def report_path
@@ -36,6 +37,10 @@ module TestBoosters
36
37
  ENV["RSPEC_SPLIT_CONFIGURATION_PATH"] || "#{ENV["HOME"]}/rspec_split_configuration.json"
37
38
  end
38
39
 
40
+ def formatter_path
41
+ @formatter_path ||= File.join(::TestBoosters::ROOT_PATH, "rspec_formatters/semaphore_rspec3_json_formatter.rb")
42
+ end
43
+
39
44
  end
40
45
  end
41
46
  end
@@ -15,14 +15,14 @@ module TestBoosters
15
15
  end
16
16
 
17
17
  def display_rspec_version
18
- command = "(bundle list | grep -q '* rspec') && bundle exec rspec --version || echo 'not found'"
18
+ command = "(bundle list | grep -q '* rspec') && (bundle exec rspec --version | head -1) || echo 'not found'"
19
19
  version = TestBoosters::Shell.evaluate(command)
20
20
 
21
21
  puts "RSpec Version: #{version}"
22
22
  end
23
23
 
24
24
  def display_cucumber_version
25
- command = "(bundle list | grep -q '* cucumber') && bundle exec cucumber --version || echo 'not found'"
25
+ command = "(bundle list | grep -q '* cucumber') && (bundle exec cucumber --version | head -1) || echo 'not found'"
26
26
  version = TestBoosters::Shell.evaluate(command)
27
27
 
28
28
  puts "Cucumber Version: #{version}"
@@ -1,3 +1,3 @@
1
1
  module TestBoosters
2
- VERSION = "2.0.2".freeze
2
+ VERSION = "2.1.0".freeze
3
3
  end
data/lib/test_boosters.rb CHANGED
@@ -23,4 +23,6 @@ module TestBoosters
23
23
  require "test_boosters/boosters/go_test"
24
24
  require "test_boosters/boosters/ex_unit"
25
25
  require "test_boosters/boosters/minitest"
26
+
27
+ ROOT_PATH = File.absolute_path(File.dirname(__FILE__) + "/..")
26
28
  end
@@ -0,0 +1,50 @@
1
+ RSpec::Support.require_rspec_core "formatters/base_formatter"
2
+ require 'json'
3
+
4
+ class SemaphoreFormatter < RSpec::Core::Formatters::BaseFormatter
5
+ RSpec::Core::Formatters.register self, :stop, :close
6
+
7
+ attr_reader :output_hash
8
+
9
+ def initialize(output)
10
+ super
11
+ @output_hash = {}
12
+ end
13
+
14
+ def stop(notification)
15
+ @output_hash[:examples] = notification.examples.map { |example| format_example(example) }
16
+ end
17
+
18
+ def close(_notification)
19
+ output.write @output_hash.to_json
20
+ output.close if IO === output && output != $stdout
21
+ end
22
+
23
+ private
24
+
25
+ def format_example(example)
26
+ result = example.execution_result
27
+
28
+ {
29
+ :description => example.description,
30
+ :full_description => example.full_description,
31
+ :status => result.status,
32
+ :file_path => file_path(example),
33
+ :run_time => result.run_time
34
+ }
35
+ end
36
+
37
+ def file_path(example)
38
+ # In case of a shared_example
39
+ # example[:file_path] returns the path of the shared_example file
40
+ #
41
+ # We are interested in the duration of the file from which the shared_example was called instead.
42
+ #
43
+ # We can get this infor from `example.id`.
44
+ #
45
+ # It has the following format: `./spec/models/analysis_spec.rb[1:17:1:1:1]`
46
+ # We are droping the angle brackets at the end.
47
+
48
+ example.id.gsub(/\[.*\]$/, "")
49
+ end
50
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semaphore_test_boosters
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Developers at Rendered Text
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-30 00:00:00.000000000 Z
11
+ date: 2017-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semaphore_cucumber_booster_config
@@ -166,6 +166,7 @@ files:
166
166
  - lib/test_boosters/project_info.rb
167
167
  - lib/test_boosters/shell.rb
168
168
  - lib/test_boosters/version.rb
169
+ - rspec_formatters/semaphore_rspec3_json_formatter.rb
169
170
  - test_boosters.gemspec
170
171
  homepage: https://github.com/renderedtext/test-boosters
171
172
  licenses: