You can check command line length constraint with `xargs --show-limits`
https://stackoverflow.com/a/6849345/202914

For a deep dive, you can check https://github.com/ArturT/knapsack, a
library that splits your specs across several workers, and see if there are
some limitation workarounds there. I haven't seen much problems with using
knapsack, so we can assume they do it in the correct way.

For the built-in mechanisms, you can check examples.txt and running `rspec
--only-failures`.

- Phil

On Thu, Apr 9, 2020 at 1:02 PM Eric Kessler <[email protected]> wrote:

>
>
> On Thursday, April 9, 2020 at 2:44:17 AM UTC-7, Jon Rowe wrote:
>>
>> RSpec does not have this built in, but you don’t need it to be in order
>> to achieve this, here is how to do that from a linux command line.
>>
>> `rspec $(cat your_file.txt)`
>>
>
>
> That is a straightforward way of building a command line, yes, and I could
> certainly build such a command in pure Ruby (which would be my preference
> because I need cross-platform compatibility) before handing it off to
> whatever child process I need to execute it. However, I am cautious of that
> kind of approach because surely there is some practical limitation to how
> long a command can be. Yes, the internal test runner can easily iterate
> over an array that has a million or so entries but won't the
> Linux/Windows/OSX terminal that I have to feed the initial rspec command
> into complain about the command length at some point?
>
> I'm looking for a general and reliable solution so that I don't have to
> worry about losing tests if the command gets cut short or have to come up
> with a new approach if the terminal errors out on the input or something.
> Currently, my alternative idea would be to build a string containing Ruby
> code that sucks in the file as an array and then hands that array to the
> RSpec test runner to execute. It isn't as elegant but I'm at least pretty
> certain that it will consistently work.
>
>
> Eric K
>
>
>
>>
>> Cheers
>> Jon Rowe
>> ---------------------------
>> [email protected]
>> jonrowe.co.uk
>>
>> On 9 April 2020 at 10:37, Eric Kessler wrote:
>>
>> I've looked around online a bit but cannot find any examples of (or
>> evidence that it is even possible to) have RSpec run a set of specs listed
>> in an arbitrary file as some other test frameworks can do. I don't really
>> want to build a command line that is thousands of characters long in order
>> to run many specific tests but I can easily stick the list of specs that I
>> want to run in a file like this:
>>
>> ```
>> path/to/some_spec.rb[1:1:1]
>> path/to/some_spec.rb[1:2:1]
>> path/to/some_other_spec.rb[3:1]
>> ...
>> etc.
>> ```
>>
>> Does RSpec have a mechanism that can handle that kind of input or am I
>> limited to just specifying files and patterns on the command line?
>>
>>
>> Thanks,
>> Eric K
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "rspec" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rspec/727fdb18-8631-45fe-98bd-94240984c951%40googlegroups.com
> <https://groups.google.com/d/msgid/rspec/727fdb18-8631-45fe-98bd-94240984c951%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/CAAk5Ok-4YNtfbprXHX4zjLz-qsLx_PRq3eE%2B1GUmn8oudryVvA%40mail.gmail.com.

Reply via email to