Skip to content

Commit

Permalink
test: debug stack frames for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pftg committed Dec 10, 2023
1 parent 7f70534 commit 1edfa9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/capybara/screenshot/diff/test_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ def screenshot(name, skip_stack_frames: 0, **options)

return false unless job

pp caller
puts "-" * 80
pp caller[skip_stack_frames]
job.prepend(caller[skip_stack_frames])

if Screenshot::Diff.delayed
Expand Down
9 changes: 5 additions & 4 deletions test/capybara/screenshot/diff/test_methods_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,23 @@ def test_skip_stack_frames
assert_predicate @test_screenshots, :blank?
make_comparison(:a, :c, destination: Rails.root / "doc/screenshots/a.png")

our_screenshot("a", 1)
our_screenshot("a", 0)
assert_equal 1, @test_screenshots.size
unless ENV["RBS_TEST_TARGET"] # RBS generates new methods for checking types, so we do not know their names
pp @test_screenshots
assert_match(
/test_methods_test.rb:\d+:in `our_screenshot'/,
@test_screenshots.dig(0, 0, 0)
@test_screenshots[0][0]
)
end
assert_equal "a", @test_screenshots[0][1]

our_screenshot("a", 2)
our_screenshot("a", 1)
assert_equal 2, @test_screenshots.size
unless ENV["RBS_TEST_TARGET"] # RBS generates new methods for checking types, so we do not know their names
assert_match(
/test_methods_test.rb:.*?test_skip_stack_frames/,
@test_screenshots.dig(1, 0, 0)
@test_screenshots.dig(1, 0)
)
end
assert_equal "a", @test_screenshots[1][1]
Expand Down

0 comments on commit 1edfa9f

Please sign in to comment.