retest 0.8.0.pre → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +19 -2
- data/Gemfile +0 -2
- data/Gemfile.lock +2 -73
- data/README.md +5 -0
- data/bin/test/hanami-app +6 -0
- data/bin/test/rails-app +6 -0
- data/bin/test/ruby-app +6 -0
- data/exe/retest +4 -1
- data/lib/retest.rb +6 -11
- data/lib/retest/repository.rb +17 -2
- data/lib/retest/runner.rb +31 -3
- data/lib/retest/version.rb +1 -1
- data/lib/retest/version_control.rb +11 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e058f016e23d459435e738ff0cf3406d65e39b5a504e19abfe3df6dcc695376
|
4
|
+
data.tar.gz: f8c6039063902c21e3b5917dc768b46abdf599c14368984892ba41624565ede0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67b0d493529e376e1a0f439c618f3e0c8f208ad9ba7ea64c023d15d09fbd641f54106d6ece13be8941a586a924285d23e89940da5e271a559ba17286d33c0214
|
7
|
+
data.tar.gz: d880ee6039b6d0f11a6e420df26cf56358ed74291939717bc4e0db51db8c4b6e829e1bceee58af8490a9b506020c57cc0d4cde6fc7cde889691c61c5787a8956
|
data/.github/workflows/ci.yml
CHANGED
@@ -14,7 +14,7 @@ on:
|
|
14
14
|
branches: [ main ]
|
15
15
|
|
16
16
|
jobs:
|
17
|
-
|
17
|
+
unit-tests:
|
18
18
|
runs-on: ${{ matrix.os }}
|
19
19
|
strategy:
|
20
20
|
matrix:
|
@@ -36,4 +36,21 @@ jobs:
|
|
36
36
|
bundler-cache: true
|
37
37
|
- run: bundle install
|
38
38
|
- run: bundle exec rake
|
39
|
-
|
39
|
+
|
40
|
+
app-tests:
|
41
|
+
name: ${{ matrix.repo }} feature specs
|
42
|
+
runs-on: ubuntu-latest
|
43
|
+
strategy:
|
44
|
+
matrix:
|
45
|
+
repo:
|
46
|
+
- ruby-app
|
47
|
+
- rails-app
|
48
|
+
- hanami-app
|
49
|
+
steps:
|
50
|
+
- uses: actions/checkout@v2
|
51
|
+
- name: Set up Ruby
|
52
|
+
uses: ruby/setup-ruby@v1
|
53
|
+
with:
|
54
|
+
ruby-version: 2.5
|
55
|
+
bundler-cache: true
|
56
|
+
- run: bin/test/${{ matrix.repo }}
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
retest (0.8.
|
4
|
+
retest (0.8.2)
|
5
5
|
listen (~> 3.2)
|
6
6
|
string-similarity (~> 2.1)
|
7
7
|
tty-option (~> 0.1)
|
@@ -9,95 +9,24 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.0.3.2)
|
13
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>= 0.7, < 2)
|
15
|
-
minitest (~> 5.1)
|
16
|
-
tzinfo (~> 1.1)
|
17
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
18
|
-
aruba (1.0.3)
|
19
|
-
childprocess (>= 2.0, < 5.0)
|
20
|
-
contracts (~> 0.16.0)
|
21
|
-
cucumber (>= 2.4, < 6.0)
|
22
|
-
ffi (~> 1.9)
|
23
|
-
rspec-expectations (~> 3.4)
|
24
|
-
thor (~> 1.0)
|
25
|
-
builder (3.2.4)
|
26
12
|
byebug (11.1.3)
|
27
|
-
|
28
|
-
concurrent-ruby (1.1.7)
|
29
|
-
contracts (0.16.0)
|
30
|
-
cucumber (5.1.0)
|
31
|
-
builder (~> 3.2, >= 3.2.4)
|
32
|
-
cucumber-core (~> 8.0, >= 8.0.1)
|
33
|
-
cucumber-create-meta (~> 2.0, >= 2.0.1)
|
34
|
-
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
35
|
-
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
36
|
-
cucumber-html-formatter (~> 9.0, >= 9.0.0)
|
37
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
38
|
-
cucumber-wire (~> 4.0, >= 4.0.1)
|
39
|
-
diff-lcs (~> 1.4, >= 1.4.4)
|
40
|
-
multi_test (~> 0.1, >= 0.1.2)
|
41
|
-
sys-uname (~> 1.2, >= 1.2.1)
|
42
|
-
cucumber-core (8.0.1)
|
43
|
-
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
44
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
45
|
-
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
|
46
|
-
cucumber-create-meta (2.0.1)
|
47
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
48
|
-
sys-uname (~> 1.2, >= 1.2.1)
|
49
|
-
cucumber-cucumber-expressions (10.3.0)
|
50
|
-
cucumber-gherkin (15.0.2)
|
51
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
52
|
-
cucumber-html-formatter (9.0.0)
|
53
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
54
|
-
cucumber-messages (13.0.1)
|
55
|
-
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
56
|
-
cucumber-tag-expressions (2.0.4)
|
57
|
-
cucumber-wire (4.0.1)
|
58
|
-
cucumber-core (~> 8.0, >= 8.0.1)
|
59
|
-
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
60
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
61
|
-
diff-lcs (1.4.4)
|
62
|
-
ffi (1.13.1)
|
63
|
-
i18n (1.8.5)
|
64
|
-
concurrent-ruby (~> 1.0)
|
13
|
+
ffi (1.14.2)
|
65
14
|
listen (3.4.1)
|
66
15
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
67
16
|
rb-inotify (~> 0.9, >= 0.9.10)
|
68
|
-
middleware (0.1.0)
|
69
17
|
minitest (5.14.1)
|
70
|
-
multi_test (0.1.2)
|
71
|
-
protobuf-cucumber (3.10.8)
|
72
|
-
activesupport (>= 3.2)
|
73
|
-
middleware
|
74
|
-
thor
|
75
|
-
thread_safe
|
76
18
|
rake (12.3.3)
|
77
19
|
rb-fsevent (0.10.4)
|
78
20
|
rb-inotify (0.10.1)
|
79
21
|
ffi (~> 1.0)
|
80
|
-
rspec-expectations (3.9.2)
|
81
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
-
rspec-support (~> 3.9.0)
|
83
|
-
rspec-support (3.9.3)
|
84
22
|
string-similarity (2.1.0)
|
85
|
-
sys-uname (1.2.1)
|
86
|
-
ffi (>= 1.0.0)
|
87
|
-
thor (1.0.1)
|
88
|
-
thread_safe (0.3.6)
|
89
23
|
tty-option (0.1.0)
|
90
|
-
tzinfo (1.2.7)
|
91
|
-
thread_safe (~> 0.1)
|
92
|
-
zeitwerk (2.4.0)
|
93
24
|
|
94
25
|
PLATFORMS
|
95
26
|
ruby
|
96
27
|
|
97
28
|
DEPENDENCIES
|
98
|
-
aruba (~> 1.0)
|
99
29
|
byebug
|
100
|
-
cucumber (~> 5.1)
|
101
30
|
minitest (~> 5.0)
|
102
31
|
rake (~> 12.0)
|
103
32
|
retest!
|
data/README.md
CHANGED
@@ -104,6 +104,11 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
104
104
|
|
105
105
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
106
106
|
|
107
|
+
To run integration tests on one setup (ex: hanami-app): `bin/test/hanami-app`
|
108
|
+
|
109
|
+
To access an app container (ex: ruby-app): `docker-compose -f features/ruby-app/docker-compose.yml run retest sh`
|
110
|
+
|
111
|
+
|
107
112
|
## Contributing
|
108
113
|
|
109
114
|
Bug reports and pull requests are welcome on GitHub at https://github.com/alexb52/retest.
|
data/bin/test/hanami-app
ADDED
data/bin/test/rails-app
ADDED
data/bin/test/ruby-app
ADDED
data/exe/retest
CHANGED
data/lib/retest.rb
CHANGED
@@ -25,18 +25,13 @@ module Retest
|
|
25
25
|
|
26
26
|
def build(runner:, repository:)
|
27
27
|
Listen.to('.', only: /\.rb$/, relative: true) do |modified, added, removed|
|
28
|
-
STDOUT.puts modified
|
29
|
-
STDOUT.puts added
|
30
|
-
STDOUT.puts removed
|
31
28
|
begin
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
runner.run repository.find_test(added.first.strip)
|
39
|
-
end
|
29
|
+
repository.add(added)
|
30
|
+
repository.remove(removed)
|
31
|
+
runner.remove(removed)
|
32
|
+
system('clear 2>/dev/null') || system('cls 2>/dev/null')
|
33
|
+
|
34
|
+
runner.run repository.find_test (modified + added).first
|
40
35
|
rescue => e
|
41
36
|
puts "Something went wrong: #{e.message}"
|
42
37
|
end
|
data/lib/retest/repository.rb
CHANGED
@@ -10,14 +10,29 @@ module Retest
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def find_test(path)
|
13
|
+
return unless path
|
14
|
+
return if path.empty?
|
15
|
+
|
13
16
|
cache[path] ||= select_from TestOptions.for(path, files: files)
|
14
17
|
end
|
15
18
|
|
16
|
-
def add(
|
17
|
-
|
19
|
+
def add(added)
|
20
|
+
return if added && added.empty?
|
21
|
+
|
22
|
+
files.push(*added)
|
18
23
|
files.sort!
|
19
24
|
end
|
20
25
|
|
26
|
+
def remove(removed)
|
27
|
+
return if removed && removed.empty?
|
28
|
+
|
29
|
+
if removed.is_a?(Array)
|
30
|
+
removed.each { |file| files.delete(file) }
|
31
|
+
else
|
32
|
+
files.delete(removed)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
21
36
|
private
|
22
37
|
|
23
38
|
def select_from(tests)
|
data/lib/retest/runner.rb
CHANGED
@@ -20,10 +20,20 @@ module Retest
|
|
20
20
|
command == obj.command
|
21
21
|
end
|
22
22
|
|
23
|
+
def cached_test_file
|
24
|
+
@cached_test_file
|
25
|
+
end
|
26
|
+
|
27
|
+
def cached_test_file=(value)
|
28
|
+
@cached_test_file = value || @cached_test_file
|
29
|
+
end
|
30
|
+
|
23
31
|
def run(test_file = nil)
|
24
|
-
|
25
|
-
|
26
|
-
|
32
|
+
self.cached_test_file = test_file
|
33
|
+
|
34
|
+
if cached_test_file
|
35
|
+
puts "Test File Selected: #{cached_test_file}"
|
36
|
+
system command.gsub('<test>', cached_test_file)
|
27
37
|
else
|
28
38
|
puts <<~ERROR
|
29
39
|
404 - Test File Not Found
|
@@ -31,12 +41,30 @@ module Retest
|
|
31
41
|
ERROR
|
32
42
|
end
|
33
43
|
end
|
44
|
+
|
45
|
+
def remove(purged)
|
46
|
+
return if purged.empty?
|
47
|
+
|
48
|
+
if purged.is_a? Array
|
49
|
+
purge_cache if purged.include? cached_test_file
|
50
|
+
elsif purged.is_a? String
|
51
|
+
purge_cache if purged == cached_test_file
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def purge_cache
|
58
|
+
@cached_test_file = nil
|
59
|
+
end
|
34
60
|
end
|
35
61
|
|
36
62
|
HardcodedRunner = Struct.new(:command) do
|
37
63
|
def run(_ = nil)
|
38
64
|
system command
|
39
65
|
end
|
66
|
+
|
67
|
+
def remove(_ = nil); end
|
40
68
|
end
|
41
69
|
end
|
42
70
|
end
|
data/lib/retest/version.rb
CHANGED
@@ -31,7 +31,17 @@ module Retest
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def files
|
34
|
-
|
34
|
+
(untracked_files + tracked_files).sort
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def untracked_files
|
40
|
+
`git ls-files --other --exclude-standard -z`.split("\x0")
|
41
|
+
end
|
42
|
+
|
43
|
+
def tracked_files
|
44
|
+
`git ls-files -z`.split("\x0")
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: retest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Barret
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: string-similarity
|
@@ -71,6 +71,9 @@ files:
|
|
71
71
|
- Rakefile
|
72
72
|
- bin/console
|
73
73
|
- bin/setup
|
74
|
+
- bin/test/hanami-app
|
75
|
+
- bin/test/rails-app
|
76
|
+
- bin/test/ruby-app
|
74
77
|
- exe/retest
|
75
78
|
- lib/retest.rb
|
76
79
|
- lib/retest/options.rb
|
@@ -97,9 +100,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
100
|
version: 2.3.0
|
98
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
102
|
requirements:
|
100
|
-
- - "
|
103
|
+
- - ">="
|
101
104
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
105
|
+
version: '0'
|
103
106
|
requirements: []
|
104
107
|
rubygems_version: 3.0.3
|
105
108
|
signing_key:
|