How to run a specific test with Create React App

You can use the name of the file in the command, and it will run only it.

For example:

npm test src/App.test.js

I have done this by using -- to pass custom arguments to the npm script.

Documentation on this option can be found here: https://docs.npmjs.com/cli/run-script

So, to run a single test in a create-react-app application, I run the following:

npm run test -- -t 'test-name'

Where test-name is the value used in the describe function in jest -

describe('test-name', () => {
  it('does something', () => { ... });
});