Jest Mock User Module in All Test Files

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)