| b69ab31 | | | 1 | /** |
| b69ab31 | | | 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| b69ab31 | | | 3 | * |
| b69ab31 | | | 4 | * This source code is licensed under the MIT license found in the |
| b69ab31 | | | 5 | * LICENSE file in the root directory of this source tree. |
| b69ab31 | | | 6 | */ |
| b69ab31 | | | 7 | |
| b69ab31 | | | 8 | // jest-dom adds custom jest matchers for asserting on DOM nodes. |
| b69ab31 | | | 9 | // allows you to do things like: |
| b69ab31 | | | 10 | // expect(element).toHaveTextContent(/react/i) |
| b69ab31 | | | 11 | // learn more: https://github.com/testing-library/jest-dom |
| b69ab31 | | | 12 | import '@testing-library/jest-dom'; |
| b69ab31 | | | 13 | |
| b69ab31 | | | 14 | /* eslint-disable no-console */ |
| b69ab31 | | | 15 | global.console = require('console'); |
| b69ab31 | | | 16 | |
| b69ab31 | | | 17 | jest.mock('@stylexjs/stylex'); |
| b69ab31 | | | 18 | |
| b69ab31 | | | 19 | // reduce flakiness by retrying |
| b69ab31 | | | 20 | jest.retryTimes(1); |
| b69ab31 | | | 21 | |
| b69ab31 | | | 22 | import {configure} from '@testing-library/react'; |
| b69ab31 | | | 23 | |
| b69ab31 | | | 24 | const IS_CI = !!process.env.SANDCASTLE || !!process.env.GITHUB_ACTIONS; |
| b69ab31 | | | 25 | configure({ |
| b69ab31 | | | 26 | // bump waitFor timeouts in CI where jobs may run slower |
| b69ab31 | | | 27 | asyncUtilTimeout: IS_CI ? 30_000 : 20_000, |
| b69ab31 | | | 28 | ...(process.env.HIDE_RTL_DOM_ERRORS |
| b69ab31 | | | 29 | ? { |
| b69ab31 | | | 30 | getElementError: (message: string | null) => { |
| b69ab31 | | | 31 | const error = new Error(message ?? ''); |
| b69ab31 | | | 32 | error.name = 'TestingLibraryElementError'; |
| b69ab31 | | | 33 | error.stack = undefined; |
| b69ab31 | | | 34 | return error; |
| b69ab31 | | | 35 | }, |
| b69ab31 | | | 36 | } |
| b69ab31 | | | 37 | : {}), |
| b69ab31 | | | 38 | }); |
| b69ab31 | | | 39 | |
| b69ab31 | | | 40 | global.ResizeObserver = require('resize-observer-polyfill'); |