insta 0.2.9 → 0.3.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/LICENSE.txt +1 -1
- data/Rakefile +30 -3
- data/exe/insta +6 -0
- data/lib/insta/ansi.rb +30 -0
- data/lib/insta/ci.rb +21 -0
- data/lib/insta/cli.rb +714 -0
- data/lib/insta/config_manifest.rb +56 -0
- data/lib/insta/configuration.rb +86 -2
- data/lib/insta/diff.rb +134 -0
- data/lib/insta/inline/call_finder.rb +37 -0
- data/lib/insta/inline/edit.rb +21 -0
- data/lib/insta/inline/file_patcher.rb +269 -0
- data/lib/insta/inline/pending_registry.rb +57 -0
- data/lib/insta/inline/pending_store.rb +145 -0
- data/lib/insta/minitest/assertions.rb +254 -0
- data/lib/insta/minitest/lifecycle.rb +12 -0
- data/lib/insta/minitest.rb +8 -0
- data/lib/insta/pending_locations.rb +64 -0
- data/lib/insta/pending_reporter.rb +47 -0
- data/lib/insta/redaction/applicator.rb +89 -0
- data/lib/insta/redaction/selector.rb +193 -0
- data/lib/insta/rspec/hooks.rb +18 -0
- data/lib/insta/rspec/matchers.rb +248 -0
- data/lib/insta/rspec.rb +7 -0
- data/lib/insta/serializers/base.rb +31 -0
- data/lib/insta/serializers/inspect.rb +14 -0
- data/lib/insta/serializers/json.rb +16 -0
- data/lib/insta/serializers/string.rb +14 -0
- data/lib/insta/serializers/yaml.rb +16 -0
- data/lib/insta/snapshot.rb +74 -0
- data/lib/insta/snapshot_content.rb +44 -0
- data/lib/insta/snapshot_file.rb +64 -0
- data/lib/insta/snapshot_mismatch_handler.rb +34 -0
- data/lib/insta/snapshot_name.rb +51 -0
- data/lib/insta/syntax_highlight.rb +20 -0
- data/lib/insta/update_coordinator.rb +22 -0
- data/lib/insta/version.rb +3 -1
- data/lib/insta.rb +42 -8
- data/lib/minitest/insta_plugin.rb +17 -0
- data/sig/insta/ansi.rbs +28 -0
- data/sig/insta/ci.rbs +10 -0
- data/sig/insta/cli.rbs +150 -0
- data/sig/insta/config_manifest.rbs +27 -0
- data/sig/insta/configuration.rbs +48 -0
- data/sig/insta/diff.rbs +38 -0
- data/sig/insta/inline/call_finder.rbs +22 -0
- data/sig/insta/inline/edit.rbs +18 -0
- data/sig/insta/inline/file_patcher.rbs +55 -0
- data/sig/insta/inline/pending_registry.rbs +22 -0
- data/sig/insta/inline/pending_store.rbs +41 -0
- data/sig/insta/minitest/assertions.rbs +52 -0
- data/sig/insta/minitest/lifecycle.rbs +10 -0
- data/sig/insta/minitest.rbs +2 -0
- data/sig/insta/pending_locations.rbs +22 -0
- data/sig/insta/pending_reporter.rbs +14 -0
- data/sig/insta/redaction/applicator.rbs +22 -0
- data/sig/insta/redaction/selector.rbs +58 -0
- data/sig/insta/rspec/hooks.rbs +10 -0
- data/sig/insta/rspec/matchers.rbs +71 -0
- data/sig/insta/rspec.rbs +2 -0
- data/sig/insta/serializers/base.rbs +21 -0
- data/sig/insta/serializers/inspect.rbs +10 -0
- data/sig/insta/serializers/json.rbs +10 -0
- data/sig/insta/serializers/string.rbs +10 -0
- data/sig/insta/serializers/yaml.rbs +10 -0
- data/sig/insta/snapshot.rbs +37 -0
- data/sig/insta/snapshot_content.rbs +14 -0
- data/sig/insta/snapshot_file.rbs +27 -0
- data/sig/insta/snapshot_mismatch_handler.rbs +12 -0
- data/sig/insta/snapshot_name.rbs +17 -0
- data/sig/insta/syntax_highlight.rbs +8 -0
- data/sig/insta/update_coordinator.rbs +11 -0
- data/sig/insta/version.rbs +5 -0
- data/sig/insta.rbs +12 -0
- data/sig/minitest/insta_plugin.rbs +6 -0
- data/sig/vendor/difftastic.rbs +19 -0
- data/sig/vendor/irb.rbs +5 -0
- data/sig/vendor/psych.rbs +7 -0
- data/sig/vendor/rspec.rbs +9 -0
- data/sig/vendor/rubygems.rbs +3 -0
- metadata +109 -54
- data/.DS_Store +0 -0
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -35
- data/README.md +0 -41
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/insta.gemspec +0 -36
- data/lib/.DS_Store +0 -0
- data/lib/insta/account.rb +0 -127
- data/lib/insta/api.rb +0 -88
- data/lib/insta/constants.rb +0 -21
- data/lib/insta/device.rb +0 -11852
- data/lib/insta/feed.rb +0 -89
- data/lib/insta/location.rb +0 -18
- data/lib/insta/proxy_manager.rb +0 -23
- data/lib/insta/tag.rb +0 -18
- data/lib/insta/user.rb +0 -103
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pathname"
|
|
4
|
+
require "fileutils"
|
|
5
|
+
|
|
6
|
+
module Insta
|
|
7
|
+
class SnapshotFile
|
|
8
|
+
attr_reader :base_path #: Pathname
|
|
9
|
+
attr_reader :extension #: String
|
|
10
|
+
|
|
11
|
+
#: (String, String, String, ?String?) -> void
|
|
12
|
+
def initialize(base_path, test_class, test_name, extension = nil)
|
|
13
|
+
directory_resolver = Insta.configuration.snapshot_directory
|
|
14
|
+
directory = if directory_resolver
|
|
15
|
+
directory_resolver.call(test_class: test_class)
|
|
16
|
+
else
|
|
17
|
+
SnapshotName.underscore(test_class)
|
|
18
|
+
end
|
|
19
|
+
@base_path = Pathname.new(base_path) / directory
|
|
20
|
+
@test_name = test_name
|
|
21
|
+
@extension = extension || Insta.configuration.snapshot_extension
|
|
22
|
+
@counter = 0
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
#: (?Hash[Symbol, untyped]) -> Pathname
|
|
26
|
+
def path_for(options = {})
|
|
27
|
+
@counter += 1
|
|
28
|
+
filename_resolver = Insta.configuration.snapshot_filename
|
|
29
|
+
|
|
30
|
+
derived = if filename_resolver
|
|
31
|
+
filename_resolver.call(test_name: @test_name, counter: @counter, options: options)
|
|
32
|
+
else
|
|
33
|
+
SnapshotName.derive(@test_name, counter: @counter, options: options)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
@base_path / "#{derived}#{@extension}"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
#: (String) -> Pathname
|
|
40
|
+
def named_path(name)
|
|
41
|
+
@base_path / "#{SnapshotName.sanitize(name)}#{@extension}"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
#: (Pathname) -> Pathname
|
|
45
|
+
def pending_path(path)
|
|
46
|
+
Pathname.new("#{path}.new")
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
#: (Pathname, String, Snapshot::snapshot_metadata) -> void
|
|
50
|
+
def write(path, content, metadata = {})
|
|
51
|
+
FileUtils.mkdir_p(path.dirname)
|
|
52
|
+
snapshot = Snapshot.new(content, metadata)
|
|
53
|
+
|
|
54
|
+
path.write(snapshot.serialize)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
#: (Pathname) -> Snapshot?
|
|
58
|
+
def read(path)
|
|
59
|
+
return nil unless path.exist?
|
|
60
|
+
|
|
61
|
+
Snapshot.parse(path.read)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
module SnapshotMismatchHandler
|
|
5
|
+
# Returns :updated, :force_passed, or :failed
|
|
6
|
+
#: (SnapshotFile, Pathname, String, Snapshot::snapshot_metadata, String, ?caller_line: String?) -> Symbol
|
|
7
|
+
def self.handle(snapshot_file, path, content, metadata, expected, caller_line: nil)
|
|
8
|
+
coordinator = UpdateCoordinator.new(Insta.configuration.resolved_update_mode)
|
|
9
|
+
decision = coordinator.resolve(expected, content)
|
|
10
|
+
|
|
11
|
+
case decision
|
|
12
|
+
when :update
|
|
13
|
+
snapshot_file.write(path, content, metadata)
|
|
14
|
+
:updated
|
|
15
|
+
when :pending
|
|
16
|
+
pending_path = snapshot_file.pending_path(path)
|
|
17
|
+
snapshot_file.write(pending_path, content, metadata)
|
|
18
|
+
PendingLocations.add(pending_path.to_s, caller_line) if caller_line
|
|
19
|
+
|
|
20
|
+
ENV["INSTA_FORCE_PASS"] ? :force_passed : :failed
|
|
21
|
+
else
|
|
22
|
+
:failed
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
#: (String, String, String, Pathname, ?caller_line: String?) -> String
|
|
27
|
+
def self.failure_message(expected, content, label, path, caller_line: nil)
|
|
28
|
+
Diff.failure_message(
|
|
29
|
+
expected, content, label, path.to_s, caller_line,
|
|
30
|
+
file_extension: File.extname(path.to_s).delete_prefix(".")
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "digest"
|
|
4
|
+
|
|
5
|
+
module Insta
|
|
6
|
+
module SnapshotName
|
|
7
|
+
#: (String) -> String
|
|
8
|
+
def self.sanitize(name)
|
|
9
|
+
sanitizer = Insta.configuration.snapshot_sanitizer
|
|
10
|
+
|
|
11
|
+
if sanitizer
|
|
12
|
+
sanitizer.call(name)
|
|
13
|
+
else
|
|
14
|
+
name
|
|
15
|
+
.gsub(/[^a-zA-Z0-9_\-.]/, "_")
|
|
16
|
+
.gsub(/_+/, "_")
|
|
17
|
+
.gsub(/\A_|_\z/, "")
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
#: (String) -> String
|
|
22
|
+
def self.underscore(string)
|
|
23
|
+
string
|
|
24
|
+
.gsub("::", "/")
|
|
25
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
|
26
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
|
27
|
+
.tr("-", "_")
|
|
28
|
+
.tr(" ", "_")
|
|
29
|
+
.downcase
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#: (String) -> String
|
|
33
|
+
def self.strip_test_prefix(name)
|
|
34
|
+
name.sub(/\Atest_(\d+_)?/, "")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#: (String, ?counter: Integer, ?options: Hash[Symbol, untyped]) -> String
|
|
38
|
+
def self.derive(test_name, counter: 1, options: {})
|
|
39
|
+
stripped = strip_test_prefix(test_name)
|
|
40
|
+
clean_name = sanitize(stripped)
|
|
41
|
+
suffix = counter > 1 ? "-#{counter}" : ""
|
|
42
|
+
|
|
43
|
+
if options && !options.empty?
|
|
44
|
+
options_hash = Digest::MD5.hexdigest(options.inspect)
|
|
45
|
+
"#{clean_name}#{suffix}-#{options_hash}"
|
|
46
|
+
else
|
|
47
|
+
"#{clean_name}#{suffix}"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require "irb/color"
|
|
5
|
+
rescue LoadError
|
|
6
|
+
# irb not available, syntax highlighting will be skipped
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
module Insta
|
|
10
|
+
class SyntaxHighlight
|
|
11
|
+
#: (String, ?colorable: bool) -> String
|
|
12
|
+
def self.highlight(code, colorable: true)
|
|
13
|
+
return code unless colorable && defined?(IRB::Color)
|
|
14
|
+
|
|
15
|
+
IRB::Color.colorize_code(code, complete: false, colorable: true)
|
|
16
|
+
rescue StandardError
|
|
17
|
+
code
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
class UpdateCoordinator
|
|
5
|
+
#: (Symbol) -> void
|
|
6
|
+
def initialize(mode)
|
|
7
|
+
@mode = mode
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
#: (String, String) -> Symbol
|
|
11
|
+
def resolve(expected, actual)
|
|
12
|
+
return :keep if expected == actual
|
|
13
|
+
|
|
14
|
+
case @mode
|
|
15
|
+
when :force then :update
|
|
16
|
+
when :new then expected.empty? ? :update : :fail
|
|
17
|
+
when :no then :fail
|
|
18
|
+
else :pending # :auto, :pending => default to creating .snap.new
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/insta/version.rb
CHANGED
data/lib/insta.rb
CHANGED
|
@@ -1,10 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "insta/version"
|
|
4
|
+
require_relative "insta/ci"
|
|
5
|
+
require_relative "insta/configuration"
|
|
6
|
+
require_relative "insta/snapshot"
|
|
7
|
+
require_relative "insta/snapshot_content"
|
|
8
|
+
require_relative "insta/snapshot_name"
|
|
9
|
+
require_relative "insta/snapshot_file"
|
|
10
|
+
require_relative "insta/diff"
|
|
11
|
+
require_relative "insta/update_coordinator"
|
|
12
|
+
require_relative "insta/snapshot_mismatch_handler"
|
|
13
|
+
require_relative "insta/serializers/base"
|
|
14
|
+
require_relative "insta/serializers/string"
|
|
15
|
+
require_relative "insta/serializers/inspect"
|
|
16
|
+
require_relative "insta/serializers/json"
|
|
17
|
+
require_relative "insta/serializers/yaml"
|
|
18
|
+
require_relative "insta/redaction/selector"
|
|
19
|
+
require_relative "insta/redaction/applicator"
|
|
20
|
+
require_relative "insta/inline/call_finder"
|
|
21
|
+
require_relative "insta/inline/edit"
|
|
22
|
+
require_relative "insta/inline/file_patcher"
|
|
23
|
+
require_relative "insta/inline/pending_registry"
|
|
24
|
+
require_relative "insta/inline/pending_store"
|
|
25
|
+
require_relative "insta/pending_locations"
|
|
26
|
+
require_relative "insta/pending_reporter"
|
|
27
|
+
require_relative "insta/config_manifest"
|
|
28
|
+
|
|
1
29
|
module Insta
|
|
2
|
-
|
|
3
|
-
|
|
30
|
+
#: () -> Configuration
|
|
31
|
+
def self.configuration
|
|
32
|
+
@configuration ||= Configuration.new
|
|
33
|
+
end
|
|
4
34
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
35
|
+
#: () { (Configuration) -> void } -> void
|
|
36
|
+
def self.configure(&block)
|
|
37
|
+
block.call(configuration)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
#: () -> void
|
|
41
|
+
def self.reset_configuration!
|
|
42
|
+
@configuration = Configuration.new
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "insta"
|
|
4
|
+
require "insta/minitest/assertions"
|
|
5
|
+
require "insta/minitest/lifecycle"
|
|
6
|
+
|
|
7
|
+
module Minitest
|
|
8
|
+
#: (Hash[Symbol, untyped]) -> void
|
|
9
|
+
def self.plugin_insta_init(_options)
|
|
10
|
+
Minitest::Test.include(Insta::Minitest::Assertions)
|
|
11
|
+
Minitest::Test.include(Insta::Minitest::Lifecycle)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Minitest.after_run do
|
|
16
|
+
Insta::PendingReporter.flush_and_report!
|
|
17
|
+
end
|
data/sig/insta/ansi.rbs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Generated from lib/insta/ansi.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
module ANSI
|
|
5
|
+
private
|
|
6
|
+
|
|
7
|
+
# : () -> bool
|
|
8
|
+
def color?: () -> bool
|
|
9
|
+
|
|
10
|
+
# : (String) -> String
|
|
11
|
+
def bold: (String) -> String
|
|
12
|
+
|
|
13
|
+
# : (String) -> String
|
|
14
|
+
def dim: (String) -> String
|
|
15
|
+
|
|
16
|
+
# : (String) -> String
|
|
17
|
+
def red: (String) -> String
|
|
18
|
+
|
|
19
|
+
# : (String) -> String
|
|
20
|
+
def green: (String) -> String
|
|
21
|
+
|
|
22
|
+
# : (String) -> String
|
|
23
|
+
def yellow: (String) -> String
|
|
24
|
+
|
|
25
|
+
# : (String) -> String
|
|
26
|
+
def cyan: (String) -> String
|
|
27
|
+
end
|
|
28
|
+
end
|
data/sig/insta/ci.rbs
ADDED
data/sig/insta/cli.rbs
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Generated from lib/insta/cli.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
class CLI
|
|
5
|
+
include ANSI
|
|
6
|
+
|
|
7
|
+
COMMANDS: untyped
|
|
8
|
+
|
|
9
|
+
MIN_GAP: Integer
|
|
10
|
+
|
|
11
|
+
# : (Array[String]) -> void
|
|
12
|
+
def initialize: (Array[String]) -> void
|
|
13
|
+
|
|
14
|
+
# : () -> void
|
|
15
|
+
def run: () -> void
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def pluralize: (untyped count, untyped singular, ?untyped plural) -> untyped
|
|
20
|
+
|
|
21
|
+
# : () -> void
|
|
22
|
+
def review: () -> void
|
|
23
|
+
|
|
24
|
+
# : (Array[String]) -> void
|
|
25
|
+
def review_files: (Array[String]) -> void
|
|
26
|
+
|
|
27
|
+
# : (String) -> Symbol
|
|
28
|
+
def review_single_file: (String) -> Symbol
|
|
29
|
+
|
|
30
|
+
# : () -> String
|
|
31
|
+
def prompt_review_action: () -> String
|
|
32
|
+
|
|
33
|
+
# : () -> String
|
|
34
|
+
def review_prompt_line: () -> String
|
|
35
|
+
|
|
36
|
+
# : (String) -> void
|
|
37
|
+
def display_source_context: (String) -> void
|
|
38
|
+
|
|
39
|
+
# : (String) -> String?
|
|
40
|
+
def find_test_file: (String) -> String?
|
|
41
|
+
|
|
42
|
+
# : (String, String) -> Integer?
|
|
43
|
+
def find_test_line: (String, String) -> Integer?
|
|
44
|
+
|
|
45
|
+
# : (String) -> void
|
|
46
|
+
def display_caller_context: (String) -> void
|
|
47
|
+
|
|
48
|
+
# : (String, String) -> void
|
|
49
|
+
def display_snapshot_paths: (String, String) -> void
|
|
50
|
+
|
|
51
|
+
# : () -> void
|
|
52
|
+
def print_review_help: () -> void
|
|
53
|
+
|
|
54
|
+
# : (String, Integer) -> void
|
|
55
|
+
def print_source_lines: (String, Integer) -> void
|
|
56
|
+
|
|
57
|
+
# : (Array[String], Integer, Integer) -> Array[String]
|
|
58
|
+
def highlight_lines: (Array[String], Integer, Integer) -> Array[String]
|
|
59
|
+
|
|
60
|
+
# : (String, String) -> void
|
|
61
|
+
def display_diff: (String, String) -> void
|
|
62
|
+
|
|
63
|
+
# : (String, String) -> Symbol
|
|
64
|
+
def process_review_response: (String, String) -> Symbol
|
|
65
|
+
|
|
66
|
+
# : (Array[Inline::pending_store_entry]) -> void
|
|
67
|
+
def review_inline_entries: (Array[Inline::pending_store_entry]) -> void
|
|
68
|
+
|
|
69
|
+
# : (Inline::pending_store_entry) -> Symbol
|
|
70
|
+
def review_single_inline_entry: (Inline::pending_store_entry) -> Symbol
|
|
71
|
+
|
|
72
|
+
# : (String, Inline::pending_store_entry) -> Symbol
|
|
73
|
+
def process_inline_review_response: (String, Inline::pending_store_entry) -> Symbol
|
|
74
|
+
|
|
75
|
+
# : (Inline::pending_store_entry) -> void
|
|
76
|
+
def accept_inline_entry: (Inline::pending_store_entry) -> void
|
|
77
|
+
|
|
78
|
+
# : (Inline::pending_store_entry) -> void
|
|
79
|
+
def reject_inline_entry: (Inline::pending_store_entry) -> void
|
|
80
|
+
|
|
81
|
+
# : () -> void
|
|
82
|
+
def accept: () -> void
|
|
83
|
+
|
|
84
|
+
# : () -> void
|
|
85
|
+
def reject: () -> void
|
|
86
|
+
|
|
87
|
+
# : () -> void
|
|
88
|
+
def pending_list: () -> void
|
|
89
|
+
|
|
90
|
+
# : (Array[String]) -> void
|
|
91
|
+
def print_pending_files: (Array[String]) -> void
|
|
92
|
+
|
|
93
|
+
# : (Array[Inline::pending_store_entry]) -> void
|
|
94
|
+
def print_pending_inline: (Array[Inline::pending_store_entry]) -> void
|
|
95
|
+
|
|
96
|
+
# : () -> void
|
|
97
|
+
def status: () -> void
|
|
98
|
+
|
|
99
|
+
# : (String, String) -> void
|
|
100
|
+
def print_status_config: (String, String) -> void
|
|
101
|
+
|
|
102
|
+
# : (Array[String], Array[String], Array[Inline::pending_store_entry], Array[String]) -> void
|
|
103
|
+
def print_status_counts: (Array[String], Array[String], Array[Inline::pending_store_entry], Array[String]) -> void
|
|
104
|
+
|
|
105
|
+
# : (Array[String], Array[Inline::pending_store_entry]) -> void
|
|
106
|
+
def print_status_pending: (Array[String], Array[Inline::pending_store_entry]) -> void
|
|
107
|
+
|
|
108
|
+
# : (Array[[String, String]]) -> void
|
|
109
|
+
def print_status_entries: (Array[[ String, String ]]) -> void
|
|
110
|
+
|
|
111
|
+
# : () -> void
|
|
112
|
+
def clean: () -> void
|
|
113
|
+
|
|
114
|
+
# : () -> void
|
|
115
|
+
def help: () -> void
|
|
116
|
+
|
|
117
|
+
# : () -> void
|
|
118
|
+
def print_usage: () -> void
|
|
119
|
+
|
|
120
|
+
# : (String, Array[[String, String]]) -> void
|
|
121
|
+
def print_section: (String, Array[[ String, String ]]) -> void
|
|
122
|
+
|
|
123
|
+
# : () -> String
|
|
124
|
+
def header: () -> String
|
|
125
|
+
|
|
126
|
+
# : () -> void
|
|
127
|
+
def version: () -> void
|
|
128
|
+
|
|
129
|
+
# : () -> Array[[String, String]]
|
|
130
|
+
def help_commands: () -> Array[[ String, String ]]
|
|
131
|
+
|
|
132
|
+
# : () -> Array[[String, String]]
|
|
133
|
+
def help_options: () -> Array[[ String, String ]]
|
|
134
|
+
|
|
135
|
+
# : () -> Array[[String, String]]
|
|
136
|
+
def help_environment: () -> Array[[ String, String ]]
|
|
137
|
+
|
|
138
|
+
# : () -> Array[String]
|
|
139
|
+
def find_pending_files: () -> Array[String]
|
|
140
|
+
|
|
141
|
+
# : (String) -> void
|
|
142
|
+
def accept_file: (String) -> void
|
|
143
|
+
|
|
144
|
+
# : (String) -> void
|
|
145
|
+
def reject_file: (String) -> void
|
|
146
|
+
|
|
147
|
+
# : () -> void
|
|
148
|
+
def print_review_summary: () -> void
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Generated from lib/insta/config_manifest.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
# Bridges configuration from the test process to the standalone CLI.
|
|
5
|
+
#
|
|
6
|
+
# `Insta.configure` runs inside the test process (usually from the test
|
|
7
|
+
# helper), which the CLI never loads. Instead of asking users to maintain
|
|
8
|
+
# a separate config file, the test run serializes the CLI-relevant
|
|
9
|
+
# settings next to the snapshots at flush time, and the CLI applies them
|
|
10
|
+
# on startup. Machine-written state, like the pending manifests.
|
|
11
|
+
module ConfigManifest
|
|
12
|
+
FILENAME: ::String
|
|
13
|
+
|
|
14
|
+
SYMBOL_KEYS: Array[Symbol]
|
|
15
|
+
|
|
16
|
+
RAW_KEYS: Array[Symbol]
|
|
17
|
+
|
|
18
|
+
# : () -> void
|
|
19
|
+
def self.write!: () -> void
|
|
20
|
+
|
|
21
|
+
# : () -> void
|
|
22
|
+
def self.apply!: () -> void
|
|
23
|
+
|
|
24
|
+
# : () -> String
|
|
25
|
+
def self.path: () -> String
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Generated from lib/insta/configuration.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
class Configuration
|
|
5
|
+
type snapshot_filename_resolver = ^(test_name: String, counter: Integer, options: Hash[Symbol, untyped]) -> String
|
|
6
|
+
|
|
7
|
+
attr_accessor snapshot_path: String
|
|
8
|
+
|
|
9
|
+
attr_accessor diff_display: Symbol
|
|
10
|
+
|
|
11
|
+
attr_accessor diff_width: Integer?
|
|
12
|
+
|
|
13
|
+
attr_accessor diff_color: Symbol
|
|
14
|
+
|
|
15
|
+
attr_accessor update_mode: Symbol
|
|
16
|
+
|
|
17
|
+
attr_accessor default_serializer: Symbol
|
|
18
|
+
|
|
19
|
+
attr_accessor heredoc_identifier: String
|
|
20
|
+
|
|
21
|
+
attr_accessor ci_mode: Symbol
|
|
22
|
+
|
|
23
|
+
attr_accessor snapshot_extension: String
|
|
24
|
+
|
|
25
|
+
attr_accessor snapshot_sanitizer: (^(String) -> String)?
|
|
26
|
+
|
|
27
|
+
attr_accessor snapshot_filename: snapshot_filename_resolver?
|
|
28
|
+
|
|
29
|
+
attr_accessor snapshot_directory: (^(test_class: String) -> String)?
|
|
30
|
+
|
|
31
|
+
attr_accessor new_snapshot: Symbol
|
|
32
|
+
|
|
33
|
+
# : () -> void
|
|
34
|
+
def initialize: () -> void
|
|
35
|
+
|
|
36
|
+
# : () -> Symbol
|
|
37
|
+
def resolved_update_mode: () -> Symbol
|
|
38
|
+
|
|
39
|
+
# : () -> bool
|
|
40
|
+
def resolved_ci_mode?: () -> bool
|
|
41
|
+
|
|
42
|
+
# : () -> String
|
|
43
|
+
def resolved_diff_color: () -> String
|
|
44
|
+
|
|
45
|
+
# : () -> String
|
|
46
|
+
def resolved_diff_display: () -> String
|
|
47
|
+
end
|
|
48
|
+
end
|
data/sig/insta/diff.rbs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Generated from lib/insta/diff.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
class Diff
|
|
5
|
+
# : () -> Difftastic::Differ
|
|
6
|
+
def self.differ: () -> Difftastic::Differ
|
|
7
|
+
|
|
8
|
+
# : (String, String) -> String
|
|
9
|
+
def self.diff: (String, String) -> String
|
|
10
|
+
|
|
11
|
+
# : (String, String, ?file_extension: String?) -> String
|
|
12
|
+
def self.diff_with_language: (String, String, ?file_extension: String?) -> String
|
|
13
|
+
|
|
14
|
+
# : (String, String, String, ?String?, ?String?, ?file_extension: String?) -> String
|
|
15
|
+
def self.failure_message: (String, String, String, ?String?, ?String?, ?file_extension: String?) -> String
|
|
16
|
+
|
|
17
|
+
# : (String) -> String
|
|
18
|
+
def self.caller_file_location: (String) -> String
|
|
19
|
+
|
|
20
|
+
# : (String) -> String
|
|
21
|
+
def self.run_test_command: (String) -> String
|
|
22
|
+
|
|
23
|
+
# : () -> bool
|
|
24
|
+
def self.rspec?: () -> bool
|
|
25
|
+
|
|
26
|
+
# : () -> bool
|
|
27
|
+
def self.rails?: () -> bool
|
|
28
|
+
|
|
29
|
+
# : () -> bool
|
|
30
|
+
def self.minitest_cli?: () -> bool
|
|
31
|
+
|
|
32
|
+
# : () -> bool
|
|
33
|
+
def self.mtest?: () -> bool
|
|
34
|
+
|
|
35
|
+
# : () -> Integer
|
|
36
|
+
def self.terminal_width: () -> Integer
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Generated from lib/insta/inline/call_finder.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
module Inline
|
|
5
|
+
class CallFinder < Prism::Visitor
|
|
6
|
+
METHODS: Array[Symbol]
|
|
7
|
+
|
|
8
|
+
attr_reader found_call: Prism::CallNode?
|
|
9
|
+
|
|
10
|
+
# : (Integer) -> void
|
|
11
|
+
def initialize: (Integer) -> void
|
|
12
|
+
|
|
13
|
+
# : (Prism::CallNode) -> void
|
|
14
|
+
def visit_call_node: (Prism::CallNode) -> void
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
# : (Prism::Node) -> bool
|
|
19
|
+
def covers_line?: (Prism::Node) -> bool
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated from lib/insta/inline/edit.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
module Inline
|
|
5
|
+
type pending_entry = { line: Integer, content: String, type: Symbol }
|
|
6
|
+
|
|
7
|
+
class Edit
|
|
8
|
+
attr_reader start_offset: Integer
|
|
9
|
+
|
|
10
|
+
attr_reader end_offset: Integer
|
|
11
|
+
|
|
12
|
+
attr_reader replacement: String
|
|
13
|
+
|
|
14
|
+
# : (Integer, Integer, String) -> void
|
|
15
|
+
def initialize: (Integer, Integer, String) -> void
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Generated from lib/insta/inline/file_patcher.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Insta
|
|
4
|
+
module Inline
|
|
5
|
+
class FilePatcher
|
|
6
|
+
# : (String, Array[Inline::pending_entry]) -> String
|
|
7
|
+
def self.patch: (String, Array[Inline::pending_entry]) -> String
|
|
8
|
+
|
|
9
|
+
# : (String, Array[Edit]) -> String
|
|
10
|
+
def self.apply_edits: (String, Array[Edit]) -> String
|
|
11
|
+
|
|
12
|
+
# : (String, Prism::CallNode, String, Symbol) -> Edit?
|
|
13
|
+
def self.build_edit: (String, Prism::CallNode, String, Symbol) -> Edit?
|
|
14
|
+
|
|
15
|
+
# : (Prism::Node) -> bool
|
|
16
|
+
def self.heredoc_node?: (Prism::Node) -> bool
|
|
17
|
+
|
|
18
|
+
# : (Prism::ArgumentsNode) -> Prism::Node?
|
|
19
|
+
def self.find_snapshot_argument: (Prism::ArgumentsNode) -> Prism::Node?
|
|
20
|
+
|
|
21
|
+
# : (Prism::StringNode, String) -> Edit?
|
|
22
|
+
def self.build_string_edit: (Prism::StringNode, String) -> Edit?
|
|
23
|
+
|
|
24
|
+
# : (String, Prism::StringNode | Prism::InterpolatedStringNode, String) -> Edit?
|
|
25
|
+
def self.build_heredoc_edit: (String, Prism::StringNode | Prism::InterpolatedStringNode, String) -> Edit?
|
|
26
|
+
|
|
27
|
+
# : (String, Prism::StringNode | Prism::InterpolatedStringNode, String) -> Edit?
|
|
28
|
+
def self.build_heredoc_to_string_edit: (String, Prism::StringNode | Prism::InterpolatedStringNode, String) -> Edit?
|
|
29
|
+
|
|
30
|
+
# : (String, Prism::CallNode, Prism::StringNode, String) -> Edit?
|
|
31
|
+
def self.build_string_to_heredoc_edit: (String, Prism::CallNode, Prism::StringNode, String) -> Edit?
|
|
32
|
+
|
|
33
|
+
# : (String, Prism::CallNode, String) -> Edit?
|
|
34
|
+
def self.build_insert_edit: (String, Prism::CallNode, String) -> Edit?
|
|
35
|
+
|
|
36
|
+
# : (String, Prism::CallNode, Prism::Location, String) -> Edit
|
|
37
|
+
def self.build_bare_call_insert_edit: (String, Prism::CallNode, Prism::Location, String) -> Edit
|
|
38
|
+
|
|
39
|
+
# : (String) -> bool
|
|
40
|
+
def self.single_line?: (String) -> bool
|
|
41
|
+
|
|
42
|
+
# : (Prism::CallNode, Prism::Location, String) -> Edit
|
|
43
|
+
def self.build_insert_string_edit: (Prism::CallNode, Prism::Location, String) -> Edit
|
|
44
|
+
|
|
45
|
+
# : (String, Prism::CallNode, Prism::Location, String) -> Edit
|
|
46
|
+
def self.build_insert_heredoc_edit: (String, Prism::CallNode, Prism::Location, String) -> Edit
|
|
47
|
+
|
|
48
|
+
# : (String, Integer) -> Integer
|
|
49
|
+
def self.detect_indent: (String, Integer) -> Integer
|
|
50
|
+
|
|
51
|
+
# : (String, String) -> void
|
|
52
|
+
def self.atomic_write: (String, String) -> void
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|