Unfortunately, this is where we part company with Create React App. In order to use Mocha, we will need to find an alternative way to work with the application. Because of the zero-configuration setup of Create React App, we cannot simply update the testing framework being used, and that is a problem for us.
Thankfully, Create React App gives us an out in the form of ejecting the application. Ejecting the React application will install all the necessary configuration files and utilities into our project and remove Create React App. Once the ejection process is finished, we will have access to all the configuration files and we will have the ability to switch to using Mocha.
To eject Create React App, execute the following command:
>npm run eject
If you take a look at the package.json in the root of the project, you will see that a lot of information and configuration have been added.
After any major modification to package.json, it is a good idea to delete node_modules and package-lock.json and then re-run npm install.