rspec / rspec-core

RSpec runner and formatters
http://rspec.info
MIT License
1.23k stars 765 forks source link

.rspec configuration works only when calling rspec form the containing folder #2919

Closed BroiSatse closed 3 years ago

BroiSatse commented 3 years ago

.rspec file ignored when executing test while in a subfolder

.rspec file works as expected, but only when running tests from the directory containing .rspec file.

Your environment

Steps to reproduce

Having any test suite with .rspec file, enter spec folder and run rspec . - tests will be executed without .rspec configuration

Expected behavior

When searching for configuration, rspec should recursively check parent folders for .rspec files and merge their configuration

Actual behavior

When running tests while inside one of the subfolders, rspec behaves as no .rspec file exists - which is problematic when configuration includes --require options.

JonRowe commented 3 years ago

Sorry, this is by design, we don't want to recursively check folders for .rspec files, that gets problematic in mono repos or vendored projects and for example would mean we require home folder .rspec files twice, the expectation is you run rspec from the project root.

You should find that symlinking .rspec to your desired target folder works