Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update `react-redux` to 9.1.2 * Run tests against different versions of React during CI * Remove unnecessary `tick` and `runAllTimers` from `cleanup.test.tsx` * Remove redundant `act` wrappers around `fireEvent` method calls - According to latest documentation of `@testing-library/react`, `fireEvent` methods are already wrapped inside `act` calls making manual wrapping unnecessary. * Workaround issue `userEvent` not working with fake timers - There currently seems to be an issue involving `sinon` fake timers used by `vitest`, `@testing-library/react` only supporting `jest` fake timers and `@testing-library/user-event` using `setTimeout` internally to simulate user actions such as button presses. Currently `@testing-library/react` only works with `jest` fake timers, which means if there are any component updates while `sinon` fake timers are running in `vitest` , `@testing-library/react` will not catch it and things start to break. - To workaround this issue, We have to setup the `user` by calling `userEvent.setup({ delay: null })`. The reason why We do this is because `@testing-library/user-event` uses `setTimeout` internally which cannot be awaited in a test while fake timers are running as it can cause the tests to indefinitely hang. So the current workaround is to disable the `delay` functionality of `userEvent` and prevent it from calling `setTimeout`. We also have to pass in `shouldAdvanceTime: true` to `vi.useFakeTimers()` as it can get around the issue of `@testing-library/react` not tracking `sinon` fake timers in `vitest`. * Fix test names in `fork.test.ts` - Fixed test names in `fork.test.ts` which could cause the terminal to flicker in Windows. * Fix issue with `console` spy inside `buildHooks.test.tsx` - `.mockReset()` should not be called in spies since it calls `.mockClear()` and returns the implementation to its **initial** form. In this case it was silencing some of the `act` related warnings emitted by `@testing-library/react` which needed to be resolved since they were calling issues. So `.mockReset()` calls on spies need to be changed to `.mockRestore()` calls since `.mockRestore()` restores the implementation to its **original** form. * Fix `act` related issues in `buildHooks.test.tsx` * Fix issues related to spies and stubbing environments in `utils.spec.ts` * Fix `console` spy related issues in `effectScenarios.test.ts` * Fix `console` spy related issues in `listenerMiddleware.test.ts` * Fix `console` spy related issues in `createApi.test.ts` * Fix wrong `test.each` and `describe.each` calls * Fix `console` spy related issues in `devWarnings.test.tsx` * Fix `console` spy related issues in `injectEndpoints.test.tsx` * Fix issue with test names in `queryFn.test.tsx` * Migrate docs to React 19 * Update `peerDependencies` of toolkit to include React v19 * Update React and React-DOM to the new rc version * Fix issues related to `console` spies in `createAsyncThunk.test.ts` * Fix issues related to stubbing envs in `createAsyncThunk.test.ts` * Fix issues related to `console` spies in `createReducer.test.ts` * Fix issues related to stubbing envs in `createReducer.test.ts` * Fix issues related to `console` spies in `createSlice.test.ts` * Fix issues related to stubbing envs in `createSlice.test.ts` * Fix issues related to `console` spies in `immutableStateInvariantMiddleware.test.ts` * Fix issues related to `console` spies in `serializableStateInvariantMiddleware.test.ts` * Change `.toHaveBeenCalledTimes(1)` to `.toHaveBeenCalledOnce()` * Change `.toHaveBeenCalledTimes(0)` to `.not.toHaveBeenCalled()` * Set `@types/react` and `@types/react-dom` to temporary types packages - We set the `@types/react` and `@types/react-dom` package resolutions to `npm:types-react` and `npm:types-react-dom` according to the React 19 migration guide. * Add `areErrorsEqual` equality tester - This was done to make sure `toHaveBeenCalledWith` will fail if we pass in the wrong Error constructor. For example the assertion will now fail if we pass in an `Error` instead of a `TypeError`. * Fix `console` spy related issues in `fakeBaseQuery.test.tsx` * Fix `console` spy related issues in `queryFn.test.tsx` * Remove `satisfies` operators in `queryFn.test.tsx` * Remove `jest-snapshot` from `resolutions` field - This was done because it was causing the unit tests in example workspaces to fail. * Remove `console-testing-library` as it is no longer needed * Fix minor JSX related type issues * Bump `jsdom` to version 25.0.1 * Bump `@testing-library/react` to version 16.1.0 * Properly `await` assertion in `tests/fork.test.ts` * Properly `await` assertion in `src/query/tests/errorHandling.test.tsx` * Migrate to React 19 * Bump TS version in website --------- Co-authored-by: Mark Erikson <[email protected]>
- Loading branch information