Skip to content

Commit ee61d8f

Browse files
committed
Fix broken test output when skipped test passes
1 parent 1709218 commit ee61d8f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

lib/quickdraw/basic_test.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,19 @@ def refute(value, ...)
5353
# Indicate that an assertion passed successfully.
5454
def success!
5555
if @skip
56-
@runner.failure!("The skipped test `#{@description}` started passing.")
56+
test_location = @block.source_location
57+
locations = caller_locations
58+
location = locations.find { |it| it.path.end_with?(".test.rb") } || locations.first
59+
60+
@runner.failure!({
61+
"class_name" => self.class.name,
62+
"test_path" => test_location[0],
63+
"test_line" => test_location[1],
64+
"description" => @description,
65+
"message" => "The skipped test `#{@description}` started passing. Remove `skip: true` to re-enable it.",
66+
"path" => location.path,
67+
"line" => location.lineno,
68+
})
5769
else
5870
@runner.success!(@description)
5971
end

0 commit comments

Comments
 (0)