diff --git a/__tests__/jest.non-parallel.config.js b/__tests__/jest.non-parallel.config.js index c874fea..599e24b 100644 --- a/__tests__/jest.non-parallel.config.js +++ b/__tests__/jest.non-parallel.config.js @@ -1,7 +1,11 @@ const baseConfig = require('./jest.config') +/** + * @type {import('@jest/types').Config.InitialOptions} + */ module.exports = { ...baseConfig, maxWorkers: 1, testMatch: [...baseConfig.testMatch, '**/__tests__/cases/non-parallel/*.ts?(x)'], + setupFilesAfterEnv: ['/setup.ts'], } diff --git a/__tests__/setup.ts b/__tests__/setup.ts new file mode 100644 index 0000000..05366db --- /dev/null +++ b/__tests__/setup.ts @@ -0,0 +1 @@ +jest.retryTimes(3) diff --git a/src/utils/getSafeWidth.test.ts b/src/utils/getSafeWidth.test.ts index 3fa04f6..ca3fdb1 100644 --- a/src/utils/getSafeWidth.test.ts +++ b/src/utils/getSafeWidth.test.ts @@ -1,5 +1,7 @@ import { getSafeWidth, MINIMAL_CONTENT_VIEWPORT_WIDTH, MINIMAL_WIDTH } from './getSafeWidth' +jest.retryTimes(3) // Math.random may result in failure due to floating point precision + it(`should shrink when window is being resized smaller`, () => { const randomGrow = 100 * Math.random() expect(