Skip to content

Commit d140fda

Browse files
pftgclaude
andcommitted
chore: add bin/ci for pre-push linter + unit tests
Auto-fixes lint errors but still fails so you review and re-commit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 12bee25 commit d140fda

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ See [Configuration Reference](docs/configuration.md) for all options.
120120

121121
**Screenshots differ between CI and local** — Use `tolerance: 0.001` or `perceptual_threshold: 2.0`. Set `window_size` for consistent dimensions.
122122

123-
**Animations cause flaky diffs**`Capybara.disable_animation = true`, or `stability_time_limit: 1`.
123+
**Animations cause flaky diffs**`Capybara::Screenshot.disable_animations = true` disables CSS animations/transitions before each screenshot. Or use `stability_time_limit: 1` to wait for animations to finish.
124124

125125
**Dynamic content always differs**`screenshot "page", skip_area: [".timestamp", "#ad-banner"]`
126126

bin/ci

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Running linter..."
5+
if ! bin/standardrb; then
6+
echo "Lint errors found. Auto-fixing..."
7+
bin/standardrb -a
8+
echo "Lint errors were auto-fixed. Please review and re-commit."
9+
exit 1
10+
fi
11+
12+
echo "Running unit tests..."
13+
bin/rake test:unit

test/support/driver_contract_tests.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module DriverContractTests
2323

2424
test "[contract] different? generates annotated images for different images" do
2525
comp = make_comparison(:a, :c)
26-
comp.different?
26+
assert comp.different?
2727

2828
assert File.exist?(comp.reporter.annotated_base_image_path)
2929
assert File.exist?(comp.reporter.annotated_image_path)

0 commit comments

Comments
 (0)