test_launcher 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/lib/test_launcher/frameworks/minitest.rb +7 -1
- data/lib/test_launcher/search/git.rb +6 -1
- data/lib/test_launcher/version.rb +1 -1
- data/test/test_launcher/minitest_integration_test.rb +16 -0
- data/test/test_launcher/search/git_test.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eeb956c9e27d345208690928c5ca4e10093e55c
|
4
|
+
data.tar.gz: c4df62db1882ff9b84f5bef8e5fce0eeae710323
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 963183622cff5cfe3cb8cf190c6af93aa4321279800ff6a77e8b1cb1c7b5a41e309ac4e8f7cb4b7e152f69a18716d2a29c4c169a79e85939b05430c1dd927882
|
7
|
+
data.tar.gz: f291362f520ddbedd6f4e6113cbca76d1d1741c8ffcf7d48810e9c239fd77868c1d75393b98372b124e9dfb10b4341bbf21f576b68e2179a68e44df8a886017d
|
data/Rakefile
CHANGED
@@ -32,7 +32,13 @@ module TestLauncher
|
|
32
32
|
#
|
33
33
|
file = files.first
|
34
34
|
grep_results = raw_searcher.grep(example_name_regex, file_pattern: file)
|
35
|
-
|
35
|
+
|
36
|
+
if grep_results.empty?
|
37
|
+
# the file exists, but doesn't appear to contain any tests...
|
38
|
+
# we'll try to run it anyway
|
39
|
+
return [file: file]
|
40
|
+
end
|
41
|
+
|
36
42
|
best_result =
|
37
43
|
grep_results
|
38
44
|
.select {|r| line_number >= r[:line_number]}
|
@@ -38,7 +38,12 @@ module TestLauncher
|
|
38
38
|
|
39
39
|
def find_files(pattern)
|
40
40
|
relative_pattern = strip_system_path(pattern)
|
41
|
-
|
41
|
+
|
42
|
+
if File.exist?(relative_pattern)
|
43
|
+
[system_path(relative_pattern)]
|
44
|
+
else
|
45
|
+
interface.ls_files(relative_pattern).map {|f| system_path(f)}
|
46
|
+
end
|
42
47
|
end
|
43
48
|
|
44
49
|
def grep(regex, file_pattern: '*')
|
@@ -628,6 +628,22 @@ module TestLauncher
|
|
628
628
|
assert shell_mock.recall(:warn).first.first.to_s.match(/Open an issue/)
|
629
629
|
end
|
630
630
|
|
631
|
+
def test__by_line_number__file_contains_no_tests
|
632
|
+
searcher = MemorySearcher.new do |searcher|
|
633
|
+
searcher.mock_file do |f|
|
634
|
+
f.path "/src/test/file_test.rb"
|
635
|
+
f.mtime Time.new(2013, 01, 01, 00, 00, 00)
|
636
|
+
f.contents <<-RB
|
637
|
+
class File1Test
|
638
|
+
end
|
639
|
+
RB
|
640
|
+
end
|
641
|
+
end
|
642
|
+
|
643
|
+
launch("file_test.rb:1", searcher: searcher)
|
644
|
+
assert_equal "cd /src && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' /src/test/file_test.rb", shell_mock.recall_exec
|
645
|
+
end
|
646
|
+
|
631
647
|
def test__rerun
|
632
648
|
searcher = MemorySearcher.new do |searcher|
|
633
649
|
searcher.mock_file do |f|
|
@@ -23,6 +23,19 @@ module TestLauncher
|
|
23
23
|
|
24
24
|
assert_equal ["/path/to/repo/inline_gem/relative/file_test.rb"], files
|
25
25
|
end
|
26
|
+
|
27
|
+
def test_find_files__returns_file_if_exists
|
28
|
+
# git ls-files will not find newly created files
|
29
|
+
interface = mock {
|
30
|
+
expects(:root_path).returns("/path/to/repo")
|
31
|
+
}
|
32
|
+
|
33
|
+
File.stubs(:exist?).with('thing_test.rb').returns(true)
|
34
|
+
searcher = Git.new(nil, interface)
|
35
|
+
files = searcher.find_files("thing_test.rb")
|
36
|
+
|
37
|
+
assert_equal ['/path/to/repo/thing_test.rb'], files
|
38
|
+
end
|
26
39
|
end
|
27
40
|
end
|
28
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_launcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Kinnecom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|