minitest-json-reporter 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/Rakefile +1 -5
- data/lib/minitest/json_reporter_plugin.rb +33 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81c254b178148457162fcd5d46d59b3b3b75388cd38c32e7f5036aabc8eef8a3
|
4
|
+
data.tar.gz: 1b219b7126a088a8d5ba03999f96247b4012ef1d2adace023524c26d2f4413d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 987a6537daa03f60adee1a2ab81ea76d299efbc7bd4625ae3d1ebc4fdd379c2ca281eff3c738c6114107dfd6772a3776575180b333da7a14b6df1e3cc40327fe
|
7
|
+
data.tar.gz: 95b304b821cdfbfe665d0bf15a4cde5544e4e380d8b938919b06b5fbd1c70b07696e98a5aa742a0ad53bfc3f779123865d3dd06445c1eb8053349cb68398c0aa
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -1,20 +1,47 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "minitest"
|
3
4
|
require "json"
|
4
5
|
|
5
6
|
module Minitest
|
7
|
+
def self.plugin_json_reporter_init(options)
|
8
|
+
if options[:json]
|
9
|
+
Minitest.reporter.reporters.clear
|
10
|
+
Minitest.reporter << JsonReporter.new(options)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.plugin_json_reporter_options(opts, options)
|
15
|
+
opts.on("--json", "Json dump") { |_json| options[:json] = true }
|
16
|
+
end
|
17
|
+
|
6
18
|
class JsonReporter < AbstractReporter
|
7
|
-
|
19
|
+
attr_accessor :io, :results
|
20
|
+
|
21
|
+
def initialize(options)
|
22
|
+
@io = options[:io]
|
23
|
+
@results = []
|
8
24
|
end
|
9
25
|
|
10
|
-
def record
|
26
|
+
def record(result)
|
27
|
+
line = result.source_location[-1]
|
28
|
+
failure = result.failures[0]
|
29
|
+
|
30
|
+
if failure
|
31
|
+
# "/Users/marcusheng/projects/rails/budgetyourtime/test/models/user_test.rb:11"
|
32
|
+
line = failure.location.split("/")[-1].split(":")[-1]
|
33
|
+
end
|
34
|
+
|
35
|
+
results << {
|
36
|
+
name: result.name,
|
37
|
+
status: result.passed? ? "PASS" : "FAIL",
|
38
|
+
failures: failure.to_s,
|
39
|
+
line: line.to_i
|
40
|
+
}.to_json
|
11
41
|
end
|
12
42
|
|
13
43
|
def report
|
14
|
-
|
15
|
-
|
16
|
-
json_report = { test: "name of the test" }
|
17
|
-
io.write(JSON.dump(json_report))
|
44
|
+
results.each { |result| io.puts result }
|
18
45
|
end
|
19
46
|
end
|
20
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-json-reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wei Zhe Heng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debug
|