Hello,
We noticed today during our upgrade from 1.0 to 2.0 that globbing tests does not include tests that are in subfolders.
Running the following in CircleCI gives the following count of our files.
circleci tests glob test/**/*.rb | circleci tests split --show-counts
Read 354 filename(s)
Current container # 0. Assigning 89 filename(s) on this container
test/subfolder/test1.rb
test/subfolder/test2.rb
...
Adding a /**/
to the path above changes the results and the output for the files.
circleci tests glob test/**/**/*.rb | circleci tests split --show-counts
Read 307 filename(s)
Current container # 0. Assigning 77 filename(s) on this container
test/subfolder/subfolder2/test1.rb
test/subfolder/subfolder2/test2.rb
We are trying to recursively run all of our tests and we have a lot of tests that are deeply nested. Is there any other way to do this?
We are also running into this issue after migrating to 2.0. Seems like an obvious issue, any suggestions?
halfer
October 15, 2018, 7:42pm
3
Interesting. Does circleci tests
have a syntax where you can supply the list piped in, or in a file? (This does sound like an unintended change, just wondering how to get you running again in the short term).
See here:
you need to add shopt -s globstar
to enable ** wildcard
etlund
April 6, 2022, 12:34am
5
How/where do I add ‘shopt -s globstar’? I’m using the ruby-orb and can’t figure out how to make it glob all my subdirectories.
You’ll want to add it before the circleci tests glob
command is run. Here’s a redacted version of my file using a multiline command:
jobs:
run_tests:
docker:
- image: *ruby_image
steps:
- checkout
- run:
name: Run tests
command: |
shopt -s globstar
SPEC_PATH="spec/**/*_spec.rb"
TEST_FILES="$(circleci tests glob ${SPEC_PATH})"
1 Like