spectracer 1.3.0 → 1.4.0
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/CHANGELOG.md +9 -0
- data/lib/spectracer/core/paths.rb +2 -2
- data/lib/spectracer/core/spec_selector.rb +2 -2
- data/lib/spectracer/io/config_loader.rb +13 -2
- data/lib/spectracer/tasks/spectracer.rake +28 -1
- data/lib/spectracer/version.rb +1 -1
- data/lib/spectracer.default.minitest.yml +16 -0
- data/lib/spectracer.default.yml +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c01031e82f15d06eeef77717e0d31ec34a5bb73940323deb023c6bf3ec13eb13
|
|
4
|
+
data.tar.gz: 77395beec7e9113f050495f1ea036e8f019814514da08fb2a90654d25f0a6a10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 30dd806f8a0428ea5890a4f39b2c315ae198c740b27fa33c629f1be9b6279d28b71227afceb349994bf6dfea58e05e5b65fa574623d63131e5b338e51ba9a13e
|
|
7
|
+
data.tar.gz: 0741cbb623678895406c7a233124654c6b54f8a96743e3bb8ab05de3e4447cafc1b8fa4affc3ea0ded7466f0aa3a2b749048e9ff96a52982f09e7e8472969669
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.0] - 2026-02-04
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Remove `./` prefix from traced paths for bktec/zzglob compatibility
|
|
8
|
+
- zzglob's `path.Clean()` normalizes `./spec/` to `spec/`, causing pattern mismatches
|
|
9
|
+
- Paths are now stored without the `./` prefix (e.g., `spec/models/user_spec.rb`)
|
|
10
|
+
- Output is compatible with both `bktec --test-file-pattern` and `rspec --pattern`
|
|
11
|
+
|
|
3
12
|
## [1.3.0] - 2026-02-02
|
|
4
13
|
|
|
5
14
|
### Added
|
|
@@ -34,8 +34,8 @@ module Spectracer
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def normalize(file_path, repo_root:)
|
|
37
|
-
relative = file_path.sub(
|
|
38
|
-
relative.
|
|
37
|
+
relative = file_path.sub(%r{\A#{Regexp.escape(repo_root)}/?}, "")
|
|
38
|
+
relative.sub(%r{\A\./}, "")
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def strip_dot_prefix(path)
|
|
@@ -16,12 +16,12 @@ module Spectracer
|
|
|
16
16
|
changed_files.each do |file|
|
|
17
17
|
matched_specs = []
|
|
18
18
|
|
|
19
|
-
if file.end_with?("_spec.rb")
|
|
19
|
+
if file.end_with?("_spec.rb", "_test.rb")
|
|
20
20
|
spec_set.add(file)
|
|
21
21
|
matched_specs << file
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
file_key = file.
|
|
24
|
+
file_key = file.sub(%r{\A\./}, "")
|
|
25
25
|
if (specs = inverse_deps[file_key])
|
|
26
26
|
spec_set.merge(specs)
|
|
27
27
|
matched_specs.concat(specs)
|
|
@@ -6,7 +6,8 @@ module Spectracer
|
|
|
6
6
|
module IO
|
|
7
7
|
class ConfigLoader
|
|
8
8
|
FILE_PATH = ".spectracer.yml"
|
|
9
|
-
|
|
9
|
+
DEFAULT_RSPEC_FILE_PATH = File.expand_path("../../spectracer.default.yml", __dir__)
|
|
10
|
+
DEFAULT_MINITEST_FILE_PATH = File.expand_path("../../spectracer.default.minitest.yml", __dir__)
|
|
10
11
|
|
|
11
12
|
def initialize(logger: nil)
|
|
12
13
|
@logger = logger
|
|
@@ -29,7 +30,17 @@ module Spectracer
|
|
|
29
30
|
YAML.safe_load_file(FILE_PATH)
|
|
30
31
|
else
|
|
31
32
|
@logger&.debug("No configuration file found at #{FILE_PATH.inspect}. Using defaults.")
|
|
32
|
-
YAML.safe_load_file(
|
|
33
|
+
YAML.safe_load_file(default_file_path)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def default_file_path
|
|
38
|
+
if defined?(RSpec)
|
|
39
|
+
DEFAULT_RSPEC_FILE_PATH
|
|
40
|
+
elsif defined?(Minitest)
|
|
41
|
+
DEFAULT_MINITEST_FILE_PATH
|
|
42
|
+
else
|
|
43
|
+
DEFAULT_RSPEC_FILE_PATH
|
|
33
44
|
end
|
|
34
45
|
end
|
|
35
46
|
|
|
@@ -10,12 +10,39 @@ namespace :spectracer do
|
|
|
10
10
|
exit 0
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
framework = detect_test_framework
|
|
14
|
+
default_file_path = case framework
|
|
15
|
+
when :minitest
|
|
16
|
+
Spectracer::IO::ConfigLoader::DEFAULT_MINITEST_FILE_PATH
|
|
17
|
+
else
|
|
18
|
+
Spectracer::IO::ConfigLoader::DEFAULT_RSPEC_FILE_PATH
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
warn "Detected test framework: #{framework}"
|
|
13
22
|
warn "Creating '#{config_path}' file."
|
|
14
23
|
|
|
15
|
-
default_content = File.read(
|
|
24
|
+
default_content = File.read(default_file_path)
|
|
16
25
|
File.write(config_path, default_content)
|
|
17
26
|
end
|
|
18
27
|
|
|
28
|
+
def detect_test_framework
|
|
29
|
+
gemfile_path = File.join(Dir.pwd, "Gemfile")
|
|
30
|
+
return :rspec unless File.exist?(gemfile_path)
|
|
31
|
+
|
|
32
|
+
gemfile_content = File.read(gemfile_path)
|
|
33
|
+
|
|
34
|
+
has_rspec = gemfile_content.match?(/['"]rspec['"]|['"]rspec-rails['"]/)
|
|
35
|
+
has_minitest = gemfile_content.match?(/['"]minitest['"]/) || Dir.exist?("test")
|
|
36
|
+
|
|
37
|
+
if has_rspec
|
|
38
|
+
:rspec
|
|
39
|
+
elsif has_minitest
|
|
40
|
+
:minitest
|
|
41
|
+
else
|
|
42
|
+
:rspec
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
19
46
|
desc "Collect spec dependencies from tracing artifacts"
|
|
20
47
|
task :collect_dependencies do
|
|
21
48
|
logger = Spectracer::Logger.new(
|
data/lib/spectracer/version.rb
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# This file was generated by the 'spectracer:install' Rake task.
|
|
2
|
+
# You can modify this file to customize the behavior of Spectracer.
|
|
3
|
+
# Test framework: Minitest
|
|
4
|
+
defaults:
|
|
5
|
+
all_specs_glob: "test/**/*_test.rb"
|
|
6
|
+
no_specs_glob: "{}"
|
|
7
|
+
|
|
8
|
+
# When no spec files are detected to run, Spectracer will run the specs defined in the 'on_empty_spec_set' key.
|
|
9
|
+
on_empty_spec_set: "{{no_specs_glob}}"
|
|
10
|
+
|
|
11
|
+
# If a file changes and it matches the glob, the corresponding pattern will be added to the list of spec files to run.
|
|
12
|
+
# These will take precedence over the 'on_empty_spec_set' key.
|
|
13
|
+
globs_matcher:
|
|
14
|
+
"Gemfile": "{{all_specs_glob}}"
|
|
15
|
+
"Gemfile.lock": "{{all_specs_glob}}"
|
|
16
|
+
"config/**": "{{all_specs_glob}}"
|
data/lib/spectracer.default.yml
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spectracer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mitch Smith
|
|
@@ -36,6 +36,7 @@ files:
|
|
|
36
36
|
- CHANGELOG.md
|
|
37
37
|
- LICENSE.txt
|
|
38
38
|
- README.md
|
|
39
|
+
- lib/spectracer.default.minitest.yml
|
|
39
40
|
- lib/spectracer.default.yml
|
|
40
41
|
- lib/spectracer.rb
|
|
41
42
|
- lib/spectracer/core/glob_factorizer.rb
|