I am trying to split my jest tests into multiple containers. However, all of the tests are running in every container which entirely defeats the purpose.
I setup a smaller set of tests for quicker testing, so only 32 tests are running and in all 3 containers all 32 tests are running.
I am using find instead of circleci blob because I need to omit the uat tests which follow the same pattern.
I just don’t understand what I am doing wrong that would result in zero splitting?
EDIT: I tried the blob command and the find one again. In the end I had to use the find command as it allows for an ignore option instead of just an advanced regex to ignore certain folders. Re-ran in the same location. multiple times and oddly enough after having all 1000+ tests running, increased the resource_class size and it is now working. Running multiple times was essential to get it to split properly.
Firstly I have to be clear, I’ve yet to need to use the split testing feature, all the testing I get involved in is against a large application stack so tests are performed sequentially.
With your switch to ‘find’ rather than ‘clrcleci tests glob’. You have checked that the output is of the same format as I can not find any details regarding what is generated by “circleci tests glob” or required by “circleci tests split”
You may need to switch back to ‘clrcleci tests glob’ to get a functional workflow that you can then modify with a known working baseline.
On a side note, I think ‘circleci tests glob’ is defined to provide find’s ability to scan across the file tree by the use of ** so a search like **/*.spec.js may be the same as your find-based search.
If you hardcode TESTFILES to just one test file instead of the result of the test splitting command that you have, what is the result? Does it still run all of the tests or just that one?
If it’s all of the tests, the issue might be with whatever is in your test:ci command and we can try to debug that further.
If it’s just one test, than the issue is likely with the tests split command and we can debug that. That command looks fine to me though assuming the “find” command returns something comparable to a glob command.
You may need to adjust your test:ci script and / or you could also try using double-dashes after npm run test:ci to cause it to pass $TESTFILES as an argument to the underlying command. You may also need to use export TESTFILES vs TESTFILES since you’re running as two separate lines.
I have done this before with jest, but don’t have the exact configs available to look at… I think I ended up including setting TESTFILES in the script itself, ugly as it was, but you could probably make it work either way.