minitest-json-reporter 0.0.1 → 0.1.1
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 +32 -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: 32e529fecda5d209b7f4a7451ed87ac425b92cb0300ad463c37f6ab99d213f58
|
4
|
+
data.tar.gz: 42b7f08dce8f6f10c158a6588a6dcae306442a8a0f6639892a6ab47ffe26ea5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a24aad31b093e75bc1f259e00caaf57aa487571632aac5c7476b516df3d88ccd1060db5442397b773548b32c5566614191c553fe9579404c9baad13dfdad9ab2
|
7
|
+
data.tar.gz: 377ed8cbef48f871c8ef2bd82b763e5e943e242e2a3648b327314a75535ade7914f37f5fe7f0204bff735f5b39561332e5ecc5aefac13a1c6d95a69cac423e65
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -4,18 +4,44 @@ require "minitest"
|
|
4
4
|
require "json"
|
5
5
|
|
6
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
|
+
|
7
18
|
class JsonReporter < AbstractReporter
|
8
|
-
|
19
|
+
attr_accessor :io, :results
|
20
|
+
|
21
|
+
def initialize(options)
|
22
|
+
@io = options[:io]
|
23
|
+
@results = []
|
9
24
|
end
|
10
25
|
|
11
|
-
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.error.to_s,
|
39
|
+
line: line.to_i
|
40
|
+
}.to_json
|
12
41
|
end
|
13
42
|
|
14
43
|
def report
|
15
|
-
|
16
|
-
|
17
|
-
json_report = { test: "name of the test" }
|
18
|
-
io.write(JSON.dump(json_report))
|
44
|
+
results.each { |result| io.puts result }
|
19
45
|
end
|
20
46
|
end
|
21
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.1
|
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
|