2021-12-02 14:40:27 +00:00
|
|
|
/**
|
|
|
|
* External Dependencies
|
|
|
|
*/
|
|
|
|
const { E2E_RETRY_TIMES } = process.env;
|
|
|
|
|
2021-12-10 16:02:21 +00:00
|
|
|
const setupJestRetries = ( retries = 0 ) => {
|
2021-12-08 19:00:02 +00:00
|
|
|
const retryTimes = E2E_RETRY_TIMES ? E2E_RETRY_TIMES : retries;
|
2021-12-02 14:40:27 +00:00
|
|
|
|
2021-12-14 18:14:41 +00:00
|
|
|
if ( retryTimes > 0 ) {
|
|
|
|
jest.retryTimes( retryTimes );
|
|
|
|
}
|
2021-12-02 14:40:27 +00:00
|
|
|
};
|
|
|
|
|
2021-12-08 19:03:08 +00:00
|
|
|
// If more methods are added to setupJestObject, it should be include in the readme
|
2021-12-02 14:40:27 +00:00
|
|
|
const setupJestObject = () => {
|
|
|
|
setupJestRetries();
|
|
|
|
};
|
|
|
|
|
2021-12-08 19:00:02 +00:00
|
|
|
module.exports = {
|
|
|
|
setupJestObject,
|
|
|
|
setupJestRetries,
|
|
|
|
};
|