koine-test_runner 0.1.1 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -2
- data/.travis.yml +4 -0
- data/README.md +15 -14
- data/bin/console +1 -1
- data/exe/run_test +2 -1
- data/koine-test_runner.gemspec +2 -2
- data/lib/koine/test_runner.rb +6 -3
- data/lib/koine/test_runner/adapters.rb +2 -2
- data/lib/koine/test_runner/adapters/base_adapter.rb +1 -3
- data/lib/koine/test_runner/adapters/{base_regexp_adapter.rb → base_regexp.rb} +1 -1
- data/lib/koine/test_runner/adapters/custom.rb +41 -0
- data/lib/koine/test_runner/adapters/{last_command_adapter.rb → last_command.rb} +1 -1
- data/lib/koine/test_runner/adapters/{null_adapter.rb → null.rb} +1 -1
- data/lib/koine/test_runner/adapters/phpunit.rb +1 -1
- data/lib/koine/test_runner/adapters/rspec.rb +1 -1
- data/lib/koine/test_runner/builder.rb +10 -5
- data/lib/koine/test_runner/configuration.rb +1 -1
- data/lib/koine/test_runner/file_matcher.rb +2 -2
- data/lib/koine/test_runner/version.rb +1 -1
- data/tests/integration_tests.sh +2 -1
- metadata +24 -25
- data/integration_test.sh +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c20c221bf08b63af4131daba570080983aa281b677273ca446c6a641015d4eaa
|
4
|
+
data.tar.gz: 7ce54b0e3062d50f020ef82253fd73cd6a93c578609a60c2207b9523cf10b6a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 979398dc02a77d09779566ed86c35347551a546c72b46ba90e9202102761bc549a8a48cab1b075a34e0d90f0ad23d4a83302704f5c33f5d53cfdbb0fae964c7a
|
7
|
+
data.tar.gz: d1fb5229c2e75d193998066f4121d326cf3a69f9ab04a3394528750a328518995e0ac9c4cecc4ac0a8553dc9222bbbe5ec9148e4740a54e532c0a1119fa68454
|
data/.rubocop.yml
CHANGED
@@ -18,13 +18,16 @@ Metrics/MethodLength:
|
|
18
18
|
Metrics/CyclomaticComplexity:
|
19
19
|
Max: 7
|
20
20
|
|
21
|
+
Style/SpecialGlobalVars:
|
22
|
+
Enabled: false
|
23
|
+
|
21
24
|
Style/GuardClause:
|
22
25
|
Enabled: false
|
23
26
|
|
24
27
|
Style/IfUnlessModifier:
|
25
28
|
Enabled: false
|
26
29
|
|
27
|
-
|
30
|
+
Naming/PredicateName:
|
28
31
|
NamePrefix:
|
29
32
|
- is_
|
30
33
|
- has_
|
@@ -46,5 +49,5 @@ AllCops:
|
|
46
49
|
Exclude:
|
47
50
|
- Gemfile
|
48
51
|
|
49
|
-
|
52
|
+
Layout/ExtraSpacing:
|
50
53
|
AllowForAlignment: true
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Easy test runner customization
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.
|
5
|
+
[![Build Status](https://travis-ci.com/mjacobus/test_runner.svg?branch=master)](https://travis-ci.com/mjacobus/test_runner)
|
6
6
|
[![Coverage Status](https://coveralls.io/repos/github/mjacobus/test_runner/badge.svg?branch=master)](https://coveralls.io/github/mjacobus/test_runner?branch=master)
|
7
7
|
[![Code Climate](https://codeclimate.com/github/mjacobus/test_runner/badges/gpa.svg)](https://codeclimate.com/github/mjacobus/test_runner)
|
8
8
|
[![Issue Count](https://codeclimate.com/github/mjacobus/test_runner/badges/issue_count.svg)](https://codeclimate.com/github/mjacobus/test_runner)
|
@@ -43,27 +43,28 @@ bundle exec run_test some/file_spec.custom
|
|
43
43
|
# .test_runner.yml
|
44
44
|
|
45
45
|
adapters:
|
46
|
-
minitest:
|
47
|
-
adapter: Koine\TestRunner\Adapter\Ruby\Minitest
|
48
|
-
file_pattern: "*_test.rb"
|
49
|
-
|
50
46
|
rspec:
|
51
|
-
adapter:
|
47
|
+
adapter: rspec
|
52
48
|
file_pattern: "*_spec.rb"
|
53
49
|
|
54
50
|
phpunit:
|
55
|
-
adapter:
|
51
|
+
adapter: phpunit
|
56
52
|
file_pattern: "*Test.php"
|
57
53
|
|
58
|
-
codeception:
|
59
|
-
adapter: Koine\TestRunner\Adapter\Php\Codeception
|
60
|
-
file_pattern: "*Spec.php"
|
61
|
-
|
62
54
|
jest:
|
63
|
-
adapter:
|
64
|
-
file_pattern: "
|
65
|
-
|
55
|
+
adapter: custom
|
56
|
+
file_pattern: "client/.*.spec.js"
|
57
|
+
command: "./node_modules/.bin/jest"
|
58
|
+
commands:
|
59
|
+
all: "{command}"
|
60
|
+
file: "{command} {file}"
|
61
|
+
# oops, jest does not really filter by line
|
62
|
+
line: "{command} {file}"
|
63
|
+
|
64
|
+
# TODO
|
66
65
|
My::CustoAdapter:
|
66
|
+
require:
|
67
|
+
- some/file
|
67
68
|
adapter: MyCustomAdapter
|
68
69
|
suffix: '_spec.custom'
|
69
70
|
```
|
data/bin/console
CHANGED
data/exe/run_test
CHANGED
data/koine-test_runner.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
lib = File.expand_path('
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
4
|
require 'koine/test_runner'
|
@@ -30,10 +30,10 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ['lib']
|
32
32
|
|
33
|
-
spec.add_development_dependency 'bundler', '~> 1.14'
|
34
33
|
spec.add_development_dependency 'coveralls', '~> 0.8.21'
|
35
34
|
spec.add_development_dependency 'object_comparator', '~> 0.1.3'
|
36
35
|
spec.add_development_dependency 'rake', '~> 10.0'
|
37
36
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 0.53.0'
|
38
38
|
spec.add_development_dependency 'simplecov', '~> 0.14.1'
|
39
39
|
end
|
data/lib/koine/test_runner.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
require 'koine/test_runner/version'
|
2
4
|
require 'koine/test_runner/command_executer'
|
3
5
|
require 'koine/test_runner/configuration'
|
4
6
|
require 'koine/test_runner/builder'
|
5
7
|
require 'koine/test_runner/adapters'
|
6
8
|
require 'koine/test_runner/adapters/base_adapter'
|
7
|
-
require 'koine/test_runner/adapters/
|
8
|
-
require 'koine/test_runner/adapters/
|
9
|
+
require 'koine/test_runner/adapters/base_regexp'
|
10
|
+
require 'koine/test_runner/adapters/custom'
|
11
|
+
require 'koine/test_runner/adapters/null'
|
12
|
+
require 'koine/test_runner/adapters/last_command'
|
9
13
|
|
10
14
|
module Koine
|
11
15
|
class TestRunner
|
12
16
|
autoload :FileMatcher, 'koine/test_runner/file_matcher'
|
13
17
|
|
14
18
|
class Adapters
|
15
|
-
autoload :BaseRegexpAdapter, 'koine/test_runner/adapters/base_regexp_adapter'
|
16
19
|
autoload :Rspec, 'koine/test_runner/adapters/rspec'
|
17
20
|
autoload :Phpunit, 'koine/test_runner/adapters/phpunit'
|
18
21
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Koine
|
2
2
|
class TestRunner
|
3
3
|
class Adapters
|
4
|
-
def initialize(adapters = [], fallback:
|
4
|
+
def initialize(adapters = [], fallback: LastCommand.new)
|
5
5
|
adapters = adapters.dup
|
6
6
|
|
7
7
|
adapters.unshift(fallback)
|
8
|
-
adapters.push(Adapters::
|
8
|
+
adapters.push(Adapters::Null.new)
|
9
9
|
|
10
10
|
adapters.inject do |previous, adapter|
|
11
11
|
previous.next_adapter = adapter
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Koine
|
2
|
+
class TestRunner
|
3
|
+
class Adapters
|
4
|
+
class Custom < BaseRegexp
|
5
|
+
def initialize(file_pattern:, command: nil, commands: {})
|
6
|
+
super(file_pattern: file_pattern)
|
7
|
+
@command = command
|
8
|
+
@commands = {}.tap do |hash|
|
9
|
+
commands.each do |key, value|
|
10
|
+
hash[key.to_sym] = value
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def all_tests(config)
|
18
|
+
command(command_for(:all), config)
|
19
|
+
end
|
20
|
+
|
21
|
+
def single_file_command(config)
|
22
|
+
command(command_for(:file), config)
|
23
|
+
end
|
24
|
+
|
25
|
+
def file_line_command(config)
|
26
|
+
command(command_for(:line), config)
|
27
|
+
end
|
28
|
+
|
29
|
+
def command_for(type)
|
30
|
+
@commands.fetch(type).to_s
|
31
|
+
end
|
32
|
+
|
33
|
+
def command(template, config)
|
34
|
+
template.sub('{command}', @command)
|
35
|
+
.sub('{file}', config.file_path.to_s)
|
36
|
+
.sub('{line}', config.line.to_s)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -22,18 +22,23 @@ module Koine
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def build_adapter(config)
|
25
|
-
|
25
|
+
adapter_name = config.delete('adapter')
|
26
|
+
adapter_class = adapter_name
|
26
27
|
|
27
|
-
if
|
28
|
-
adapter_class = "Koine::TestRunner::Adapters::#{
|
28
|
+
if adapter_class.downcase == adapter_class.to_s
|
29
|
+
adapter_class = "Koine::TestRunner::Adapters::#{classify(adapter_class)}"
|
29
30
|
end
|
30
31
|
|
31
32
|
unless Object.const_defined?(adapter_class)
|
32
|
-
raise ArgumentError, "Cannot locate adapter #{
|
33
|
+
raise ArgumentError, "Cannot locate adapter #{adapter_name} => #{adapter_class}"
|
33
34
|
end
|
34
35
|
|
35
36
|
klass = Object.const_get(adapter_class)
|
36
|
-
klass.new(symbolize_keys(config))
|
37
|
+
klass.new(**symbolize_keys(config))
|
38
|
+
end
|
39
|
+
|
40
|
+
def classify(klass)
|
41
|
+
klass.to_s.split('_').map(&:capitalize).join('')
|
37
42
|
end
|
38
43
|
|
39
44
|
def symbolize_keys(hash)
|
@@ -27,7 +27,7 @@ module Koine
|
|
27
27
|
def config_file
|
28
28
|
return @options[:config_file] if @options[:config_file]
|
29
29
|
return '.test_runner.yml' if File.exist?('.test_runner.yml')
|
30
|
-
File.expand_path('
|
30
|
+
File.expand_path('../../../config/default.yml', __dir__)
|
31
31
|
end
|
32
32
|
|
33
33
|
def run_options
|
@@ -11,8 +11,8 @@ module Koine
|
|
11
11
|
length = @lines.length
|
12
12
|
slice = length - line
|
13
13
|
lines = @lines.reverse.slice(slice, length)
|
14
|
-
lines.each do |
|
15
|
-
match = regexp.match(
|
14
|
+
lines.each do |file_line|
|
15
|
+
match = regexp.match(file_line)
|
16
16
|
return match if match
|
17
17
|
end
|
18
18
|
|
data/tests/integration_tests.sh
CHANGED
@@ -5,7 +5,8 @@ set -v
|
|
5
5
|
|
6
6
|
export SKIP_COVERAGE='true'
|
7
7
|
|
8
|
-
|
8
|
+
bundle exec rake install
|
9
|
+
# ./exe/run_test spec/fixtures/FixturePhpUnitTest.php --line=30
|
9
10
|
./exe/run_test spec/koine/test_runner_spec.rb
|
10
11
|
./exe/run_test spec/koine/test_runner_spec.rb --line=9
|
11
12
|
./exe/run_test spec/koine/test_runner_spec.rb --last
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: koine-test_runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Jacobus
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.14'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.14'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: coveralls
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +66,20 @@ dependencies:
|
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.53.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.53.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,14 +115,14 @@ files:
|
|
115
115
|
- bin/setup
|
116
116
|
- config/default.yml
|
117
117
|
- exe/run_test
|
118
|
-
- integration_test.sh
|
119
118
|
- koine-test_runner.gemspec
|
120
119
|
- lib/koine/test_runner.rb
|
121
120
|
- lib/koine/test_runner/adapters.rb
|
122
121
|
- lib/koine/test_runner/adapters/base_adapter.rb
|
123
|
-
- lib/koine/test_runner/adapters/
|
124
|
-
- lib/koine/test_runner/adapters/
|
125
|
-
- lib/koine/test_runner/adapters/
|
122
|
+
- lib/koine/test_runner/adapters/base_regexp.rb
|
123
|
+
- lib/koine/test_runner/adapters/custom.rb
|
124
|
+
- lib/koine/test_runner/adapters/last_command.rb
|
125
|
+
- lib/koine/test_runner/adapters/null.rb
|
126
126
|
- lib/koine/test_runner/adapters/phpunit.rb
|
127
127
|
- lib/koine/test_runner/adapters/rspec.rb
|
128
128
|
- lib/koine/test_runner/builder.rb
|
@@ -136,7 +136,7 @@ licenses:
|
|
136
136
|
- MIT
|
137
137
|
metadata:
|
138
138
|
allowed_push_host: https://rubygems.org
|
139
|
-
post_install_message:
|
139
|
+
post_install_message:
|
140
140
|
rdoc_options: []
|
141
141
|
require_paths:
|
142
142
|
- lib
|
@@ -151,9 +151,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
|
-
|
155
|
-
|
156
|
-
signing_key:
|
154
|
+
rubygems_version: 3.2.3
|
155
|
+
signing_key:
|
157
156
|
specification_version: 4
|
158
157
|
summary: Easy test runner
|
159
158
|
test_files: []
|
data/integration_test.sh
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
set -e
|
4
|
-
set -v
|
5
|
-
|
6
|
-
./exe/run_test spec/fixtures/FixturePhpUnitTest.php --line=30
|
7
|
-
./exe/run_test spec/koine/test_runner_spec.rb
|
8
|
-
./exe/run_test spec/koine/test_runner_spec.rb --line=9
|
9
|
-
./exe/run_test spec/koine/test_runner_spec.rb --all
|