Problem
bin/dev is a critical user-facing script that is completely untested in CI. Every bin/dev bug goes straight to users.
Evidence
Recent bugs that made it to releases:
Why This Happens
CI builds assets directly without using bin/dev:
# integration-tests.yml
- run: bundle exec rake react_on_rails:generate_packs
- run: bin/shakapacker # Direct webpack, bypasses bin/dev entirely
- run: bundle exec rake run_rspec:all_dummy
# playwright.yml
- run: bundle exec rake react_on_rails:generate_packs
- run: pnpm run build:test # Direct webpack
- run: pnpm run test:e2e
The dummy app has a bin/dev script, but it's never executed in CI.
What Should Be Tested
- Argument parsing -
--route, --verbose, commands like static, kill, help
- Script loading - No NameError, LoadError, SyntaxError
- Full startup flow - bin/dev starts, webpack compiles successfully
- Server responds - Rails serves pages correctly
Proposed Solution
Layer 1: Unit Tests (fast, every PR)
Following Rails' CLI testing pattern:
describe ".run_from_command_line" do
before do
allow(described_class).to receive(:start) # Mock execution
end
it "parses --route with separate value" do
expect(described_class).to receive(:start).with(
:development, "Procfile.dev", hash_including(route: "hello_world")
)
described_class.run_from_command_line(["--route", "hello_world"])
end
end
Layer 2: Integration Test (thorough, on master or bin/dev changes)
- name: Test bin/dev starts and compiles
run: |
./bin/dev > /tmp/bin_dev.log 2>&1 &
# Wait for "compiled successfully" or fail on errors
# Then kill the process
Acceptance Criteria
Related
Problem
bin/devis a critical user-facing script that is completely untested in CI. Everybin/devbug goes straight to users.Evidence
Recent bugs that made it to releases:
--routeflag parsing broke bin/dev immediately afterrails generate react_on_rails:installWhy This Happens
CI builds assets directly without using
bin/dev:The dummy app has a
bin/devscript, but it's never executed in CI.What Should Be Tested
--route,--verbose, commands likestatic,kill,helpProposed Solution
Layer 1: Unit Tests (fast, every PR)
Following Rails' CLI testing pattern:
Layer 2: Integration Test (thorough, on master or bin/dev changes)
Acceptance Criteria
ServerManager.run_from_command_lineargument parsingextract_command_from_argshelperbin/devand waits for webpack compile--routebug (PR Fix bin/dev failing with 'Unknown argument' when using --route flag #2273) would have been caught by these testsRelated