jest.testMatch
accepts an array of glob patterns. Like when you use ls p*
to list every file in the current directory which starts with a p
.
jest.testRegex
accepts a regex string, which is way more powerful (but maybe an overkill for what you're trying to achieve).
I'd use the one you're more familiar with. It would be redundant to set both.
Although, for some complex cases, you are better off with a regex. If you want jest
to only test files that start with a p
and have exactly three numbers in fixed places and the filename ends with .test
or .jest
, go for a regex. But don't do that anyway.