You can add setupFiles or setupFilesAfterEnv into your jest configuration to run before all your tests.
https://jestjs.io/docs/configuration#setupfiles-array
// package.json
...
"jest": {
"setupFiles": "./src/setupTests.js"
}
// setupTests.js
jest.mock('config'); // Path to config file