test-map 0.2.0 → 0.2.1
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/README.md +9 -8
- data/lib/test_map/plugins/minitest.rb +1 -2
- data/lib/test_map/plugins/rspec.rb +1 -2
- data/lib/test_map/report.rb +13 -4
- data/lib/test_map/version.rb +1 -1
- metadata +4 -4
- /data/{LICENSE → LICENSE.txt} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd8d77a4693229a3bdc64882a2771830090f7b04ae977df9eec5386e3ffc16e3
|
4
|
+
data.tar.gz: dc04407d47b77d1b5a6418072c8e380a327417a82fe27a21f31e1020d7b6b2aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d80247e944cecd9b3c06b48b63bae9052589f97713496f674dc9ad23524ebfe6e8bb0720d38a90d0ba9b0874cb33c6a9422d6cd9bf3c49c2f8db252c26dde011
|
7
|
+
data.tar.gz: 1690f86016ea54148386896023ba40e22210e2559c8d7dd175c7b728c458a9e2abdfdaa7f3a73997cbb4da446186e51033313a35df8c3e7e158a1a8cd8359f5a
|
data/README.md
CHANGED
@@ -79,14 +79,15 @@ $ TEST_MAP=1 bundle exec rspec
|
|
79
79
|
On demand you can adapt the configuration to your needs.
|
80
80
|
|
81
81
|
```ruby
|
82
|
-
TestMap::
|
83
|
-
config
|
84
|
-
config
|
82
|
+
TestMap::Config.configure do |config|
|
83
|
+
config[:logger] = Logger.new($stdout) # default logs to dev/null
|
84
|
+
config[:merge] = false # merge results (e.g. with multiple testsuites)
|
85
|
+
config[:out_file] = 'my-test-map.yml' # default is .test-map.yml
|
85
86
|
# defaults to [%r{^(vendor)/}] }
|
86
|
-
config
|
87
|
+
config[:exclude_patterns] = [%r{^(vendor|other_libraries)/}]
|
87
88
|
# register a custom rule to match new files; must implement `call(file)`;
|
88
89
|
# defaults to nil
|
89
|
-
config
|
90
|
+
config[:natural_mapping] = ->(file) { file.sub(%r{^library/}, 'test/') }
|
90
91
|
end
|
91
92
|
```
|
92
93
|
|
@@ -94,11 +95,11 @@ end
|
|
94
95
|
|
95
96
|
Open list of features:
|
96
97
|
|
97
|
-
- [
|
98
|
+
- [x] Configure file exclude list (e.g. test files are not needed).
|
98
99
|
- [ ] Auto-handle packs, packs with subdirectories.
|
99
|
-
- [
|
100
|
+
- [x] Demonstrate usage with file watchers.
|
100
101
|
- [ ] Demonstrate CI pipelines with GitHub actions and GitLab CI.
|
101
|
-
- [
|
102
|
+
- [x] Merge results.
|
102
103
|
|
103
104
|
```sh
|
104
105
|
$ bundle install # install dependencies
|
@@ -7,8 +7,7 @@ module TestMap
|
|
7
7
|
def self.included(_base)
|
8
8
|
TestMap.logger.info 'Registering hooks for Minitest'
|
9
9
|
::Minitest.after_run do
|
10
|
-
|
11
|
-
File.write "#{Dir.pwd}/#{Config.config[:out_file]}", result
|
10
|
+
TestMap.reporter.write "#{Dir.pwd}/#{Config.config[:out_file]}"
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
@@ -11,7 +11,6 @@ RSpec.configure do |config|
|
|
11
11
|
end
|
12
12
|
|
13
13
|
config.after(:suite) do
|
14
|
-
|
15
|
-
File.write "#{Dir.pwd}/#{TestMap::Config.config[:out_file]}", result
|
14
|
+
TestMap.reporter.write "#{Dir.pwd}/#{TestMap::Config.config[:out_file]}"
|
16
15
|
end
|
17
16
|
end
|
data/lib/test_map/report.rb
CHANGED
@@ -16,12 +16,21 @@ module TestMap
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def write(file)
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
content = if File.exist?(file) && Config.config[:merge]
|
20
|
+
merge(results, YAML.safe_load_file(file)).to_yaml
|
21
|
+
else
|
22
|
+
to_yaml
|
23
|
+
end
|
24
|
+
File.write file, content
|
22
25
|
end
|
23
26
|
|
24
|
-
def results = @results.transform_values { _1.to_a.sort }.sort.to_h
|
27
|
+
def results = @results.transform_values { _1.to_a.uniq.sort }.sort.to_h
|
25
28
|
def to_yaml = results.to_yaml
|
29
|
+
|
30
|
+
def merge(result, current)
|
31
|
+
current.merge(result) do |_key, oldval, newval|
|
32
|
+
(oldval + newval).uniq.sort
|
33
|
+
end
|
34
|
+
end
|
26
35
|
end
|
27
36
|
end
|
data/lib/test_map/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Lipautz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
Track files that are covered by test files to execute only the necessary
|
@@ -18,11 +18,11 @@ email:
|
|
18
18
|
executables: []
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files:
|
21
|
-
- LICENSE
|
21
|
+
- LICENSE.txt
|
22
22
|
- README.md
|
23
23
|
files:
|
24
24
|
- CHANGELOG.md
|
25
|
-
- LICENSE
|
25
|
+
- LICENSE.txt
|
26
26
|
- README.md
|
27
27
|
- lib/test_map.rb
|
28
28
|
- lib/test_map/config.rb
|
/data/{LICENSE → LICENSE.txt}
RENAMED
File without changes
|