Skip to content

Commit de7acb9

Browse files
committed
[rb] Make //rb:lint a test target that auto-corrects files too
1 parent 9f3352b commit de7acb9

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

.github/workflows/ci-ruby.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with:
3030
name: Lint
3131
cache-key: rb-lint
32-
run: bazel run //rb:lint
32+
run: bazel test //rb:lint
3333

3434
unit-tests:
3535
name: Unit Tests

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,25 +209,28 @@ Build targets:
209209
| `bazel run //rb:selenium-webdriver-release` | Build and push selenium-webdriver gem to RubyGems |
210210
| `bazel run //rb:console` | Start REPL with all gems loaded |
211211
| `bazel run //rb:docs` | Generate YARD docs |
212-
| `bazel run //rb:lint` | Run RuboCop linter |
213212

214213
Test targets:
215214

216-
| Command | Description |
217-
|--------------------------------------------------------------------------------------|---------------------------------------------------------|
218-
| `bazel test //rb/spec/...` | Run both unit and integration tests using Chrome |
219-
| `bazel test //rb/spec/integration/...` | Run integration tests using Chrome |
220-
| `bazel test //rb/spec/integration/... --define browser=firefox` | Run integration tests using Firefox |
221-
| `bazel test //rb/spec/integration/... --define remote=true` | Run integration tests using Chrome and Selenium Server |
222-
| `bazel test //rb/spec/integration/... --define browser=firefox --define remote=true` | Run integration tests using Firefox and Selenium Server |
223-
| `bazel test //rb/spec/unit/...` | Run unit tests |
215+
| Command | Description |
216+
|--------------------------------------------------------------------------------------|------------------------------------------------|
217+
| `bazel test //rb/...` | Run unit, integration tests (Chrome) and lint |
218+
| `bazel test //rb:lint` | Run RuboCop linter |
219+
| `bazel test //rb/spec/...` | Run unit and integration tests (Chrome) |
220+
| `bazel test --test_size_filters large //rb/...` | Run integration tests using (Chrome) |
221+
| `bazel test //rb/spec/integration/...` | Run integration tests using (Chrome) |
222+
| `bazel test //rb/spec/integration/... --define browser=firefox` | Run integration tests using (Firefox) |
223+
| `bazel test //rb/spec/integration/... --define remote=true` | Run integration tests using (Chrome and Grid) |
224+
| `bazel test //rb/spec/integration/... --define browser=firefox --define remote=true` | Run integration tests using (Firefox and Grid) |
225+
| `bazel test --test_size_filters small //rb/...` | Run unit tests |
226+
| `bazel test //rb/spec/unit/...` | Run unit tests |
224227

225228
Suffix `...` tells Bazel to run all the test targets. They are conveniently named by test file name with `_spec.rb` removed so you can run them individually:
226229

227230
| Test file | Test target |
228231
|----------------------------------------------------------------|----------------------------------------------------------|
229232
| `rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb` | `//rb/spec/integration/selenium/webdriver/chrome:driver` |
230-
| `rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb` | `//rb/spec/integration/selenium/webdriver/chrome:driver` |
233+
| `rb/spec/unit/selenium/webdriver/proxy_spec.rb` | `//rb/spec/unit/selenium/webdriver:proxy` |
231234

232235
Supported browsers:
233236

rb/BUILD.bazel

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ load(
55
"rb_binary",
66
"rb_gem_build",
77
"rb_gem_push",
8+
"rb_test",
89
)
910

1011
package(default_visibility = ["//:__subpackages__"])
@@ -172,17 +173,17 @@ rb_binary(
172173
],
173174
)
174175

175-
rb_binary(
176+
rb_test(
176177
name = "lint",
177-
testonly = True,
178178
srcs = glob(["**/*.rb"]),
179179
args = [
180+
"--autocorrect",
180181
"--config=rb/.rubocop.yml",
181182
"rb/",
182183
],
183184
data = [".rubocop.yml"],
184185
main = "@bundle//:bin/rubocop",
185-
tags = ["local"],
186+
tags = ["no-sandbox"],
186187
deps = [
187188
":selenium-devtools",
188189
":selenium-webdriver",

0 commit comments

Comments
 (0)