solargraph_test_coverage 0.2.6 → 0.2.7
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7c7bd9d2a4a3b6184942c28ce619023f098a515ca356e8534788adb93f9cb96
|
4
|
+
data.tar.gz: 11850e7e7184658995b6e15479e8c3c87527f4b945c8b8bc9ab446242c5dba32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4901017237a8e5cfc49e8a0228776c48929304ebb043bdd9c89500e56db2c4d7349b01838c911a3080900ca1d657b07f2d29a921d0cc39b2da96efe517d1443
|
7
|
+
data.tar.gz: c00ecc7e6c928c42a93abda3f976e3d0811934f21f21362a40711dbc449244a3e443d683a6c6204955ea3ec28989226f41d5b371344238594d78c86b3fb98987
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
solargraph_test_coverage (0.2.
|
4
|
+
solargraph_test_coverage (0.2.6)
|
5
5
|
solargraph (~> 0.40, > 0.40)
|
6
6
|
|
7
7
|
GEM
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
kramdown (~> 2.0)
|
20
20
|
nokogiri (1.12.4-x86_64-darwin)
|
21
21
|
racc (~> 1.4)
|
22
|
-
parallel (1.
|
22
|
+
parallel (1.21.0)
|
23
23
|
parser (3.0.2.0)
|
24
24
|
ast (~> 2.4.1)
|
25
25
|
racc (1.5.2)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
reverse_markdown (2.0.0)
|
30
30
|
nokogiri
|
31
31
|
rexml (3.2.5)
|
32
|
-
rubocop (1.
|
32
|
+
rubocop (1.21.0)
|
33
33
|
parallel (~> 1.10)
|
34
34
|
parser (>= 3.0.0.0)
|
35
35
|
rainbow (>= 2.2.2, < 4.0)
|
@@ -5,25 +5,36 @@ module SolargraphTestCoverage
|
|
5
5
|
# When called with a block, runs the content of said block in a new (forked) process
|
6
6
|
# the return value of the process/block can be captured and used in parent process
|
7
7
|
class ForkProcess
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
def self.call(&block)
|
9
|
+
new.run(&block)
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@read, @write = IO.pipe
|
14
|
+
end
|
13
15
|
|
16
|
+
def run(&block)
|
14
17
|
pid = fork do
|
15
|
-
read.close
|
16
|
-
|
17
|
-
Marshal.dump(result, write)
|
18
|
+
@read.close
|
19
|
+
Marshal.dump(run_block_with_timeout(&block), @write)
|
18
20
|
exit!(0) # skips exit handlers.
|
19
21
|
end
|
20
22
|
|
21
|
-
write.close
|
22
|
-
result = read.read
|
23
|
+
@write.close
|
24
|
+
result = @read.read
|
25
|
+
|
23
26
|
Process.wait(pid)
|
24
|
-
raise ChildFailedError if result.nil?
|
27
|
+
raise ChildFailedError if result.nil?
|
28
|
+
|
29
|
+
Marshal.load(result).tap { |r| raise ChildFailedError if r.nil? }
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
25
33
|
|
26
|
-
|
34
|
+
def run_block_with_timeout(&block)
|
35
|
+
Timeout.timeout(30, &block)
|
36
|
+
rescue StandardError
|
37
|
+
nil
|
27
38
|
end
|
28
39
|
end
|
29
40
|
end
|
@@ -24,7 +24,7 @@ module SolargraphTestCoverage
|
|
24
24
|
|
25
25
|
# @return [Hash]
|
26
26
|
def run_test(source)
|
27
|
-
ForkProcess.
|
27
|
+
ForkProcess.call do
|
28
28
|
Coverage.start(lines: true, branches: true)
|
29
29
|
runner = TestRunner.with(test_file(source)).run!
|
30
30
|
Coverage.result.fetch(source.location.filename, {}).merge({ test_status: runner.passed? })
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solargraph_test_coverage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Kolkey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solargraph
|