Use comma delimited test names with CircleCI test run

I am trying to get CircleCI to split my test runs across multiple containers. My repository is an Nx powered monorepo which uses jest as the test runner.

The command I’ve got so far is:

test_command="npx nx test my-project --findRelatedTests"
           npx nx test my-project --listTests | grep -E '\.spec\.' | circleci tests run --command="$test_command" --verbose --split-by=timings --timings-type=name

This works in generating a list of test names separated by spaces. However, the according to the nx documentation the findRelatedTests arg only supports when the test names are separated by commas, which is annoying because the circleci run test command will only split my tests when I pass into the command a list of space separated tests.

If I use this list of space separated tests only the first test from each group of tests runs (as nx thinks that only 1 test has been specified.

If I change my list test command to npx nx test my-project --listTests | grep -E '\.spec\.' | '\n' ' ' I get a comma separated list of tests. The first container runs the whole test suite and the other containers run nothing as the circleci command fails to acknowledge that the comma separated list should have been chopped into chunks