Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to React 19 #4409

Merged
merged 43 commits into from
Dec 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3e1a686
Update `react-redux` to 9.1.2
aryaemami59 May 11, 2024
19104b1
Run tests against different versions of React during CI
aryaemami59 May 11, 2024
3bb2014
Remove unnecessary `tick` and `runAllTimers` from `cleanup.test.tsx`
aryaemami59 May 11, 2024
c373d7b
Remove redundant `act` wrappers around `fireEvent` method calls
aryaemami59 May 11, 2024
8e5953b
Workaround issue `userEvent` not working with fake timers
aryaemami59 May 11, 2024
7e7117e
Fix test names in `fork.test.ts`
aryaemami59 May 11, 2024
657e579
Fix issue with `console` spy inside `buildHooks.test.tsx`
aryaemami59 May 14, 2024
052bb8b
Fix `act` related issues in `buildHooks.test.tsx`
aryaemami59 May 14, 2024
1bafa74
Fix issues related to spies and stubbing environments in `utils.spec.ts`
aryaemami59 May 14, 2024
d49c177
Fix `console` spy related issues in `effectScenarios.test.ts`
aryaemami59 May 14, 2024
e69a09c
Fix `console` spy related issues in `listenerMiddleware.test.ts`
aryaemami59 May 14, 2024
f8f5464
Fix `console` spy related issues in `createApi.test.ts`
aryaemami59 May 14, 2024
002c0ef
Fix wrong `test.each` and `describe.each` calls
aryaemami59 May 14, 2024
033a167
Fix `console` spy related issues in `devWarnings.test.tsx`
aryaemami59 May 14, 2024
ee7ac6b
Fix `console` spy related issues in `injectEndpoints.test.tsx`
aryaemami59 May 14, 2024
2edc4f6
Fix issue with test names in `queryFn.test.tsx`
aryaemami59 May 14, 2024
273975f
Migrate docs to React 19
aryaemami59 May 14, 2024
32e5cb6
Update `peerDependencies` of toolkit to include React v19
aryaemami59 May 14, 2024
17f6bcf
Update React and React-DOM to the new rc version
aryaemami59 May 11, 2024
fb51f2d
Fix issues related to `console` spies in `createAsyncThunk.test.ts`
aryaemami59 May 16, 2024
341dd1e
Fix issues related to stubbing envs in `createAsyncThunk.test.ts`
aryaemami59 May 16, 2024
d72d514
Fix issues related to `console` spies in `createReducer.test.ts`
aryaemami59 May 16, 2024
8b727c2
Fix issues related to stubbing envs in `createReducer.test.ts`
aryaemami59 May 16, 2024
00d2c7b
Fix issues related to `console` spies in `createSlice.test.ts`
aryaemami59 May 16, 2024
5cb8292
Fix issues related to stubbing envs in `createSlice.test.ts`
aryaemami59 May 16, 2024
4e6e0a5
Fix issues related to `console` spies in `immutableStateInvariantMidd…
aryaemami59 May 16, 2024
0b2d854
Fix issues related to `console` spies in `serializableStateInvariantM…
aryaemami59 May 16, 2024
9470fe2
Change `.toHaveBeenCalledTimes(1)` to `.toHaveBeenCalledOnce()`
aryaemami59 May 16, 2024
d194a55
Change `.toHaveBeenCalledTimes(0)` to `.not.toHaveBeenCalled()`
aryaemami59 May 16, 2024
0b01841
Set `@types/react` and `@types/react-dom` to temporary types packages
aryaemami59 May 11, 2024
7b4f651
Add `areErrorsEqual` equality tester
aryaemami59 Aug 1, 2024
0ffbdaa
Fix `console` spy related issues in `fakeBaseQuery.test.tsx`
aryaemami59 Aug 1, 2024
18ace12
Fix `console` spy related issues in `queryFn.test.tsx`
aryaemami59 Aug 1, 2024
d3ab03c
Remove `satisfies` operators in `queryFn.test.tsx`
aryaemami59 Aug 1, 2024
a182aef
Remove `jest-snapshot` from `resolutions` field
aryaemami59 Aug 1, 2024
36a83f2
Remove `console-testing-library` as it is no longer needed
aryaemami59 Aug 2, 2024
87bed72
Fix minor JSX related type issues
aryaemami59 Dec 3, 2024
7c516a0
Bump `jsdom` to version 25.0.1
aryaemami59 May 11, 2024
a54282d
Bump `@testing-library/react` to version 16.1.0
aryaemami59 Dec 6, 2024
2ef14cb
Properly `await` assertion in `tests/fork.test.ts`
aryaemami59 Dec 6, 2024
36e3bff
Properly `await` assertion in `src/query/tests/errorHandling.test.tsx`
aryaemami59 Dec 6, 2024
6410899
Migrate to React 19
aryaemami59 Dec 6, 2024
19acec8
Bump TS version in website
markerikson Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix issues related to console spies in createAsyncThunk.test.ts
aryaemami59 committed Dec 6, 2024

Verified

This commit was signed with the committer’s verified signature.
aryaemami59 Arya Emami
commit fb51f2d19fe4337e5cfe26d0d94a8cb9ee7bc5a7
27 changes: 10 additions & 17 deletions packages/toolkit/src/tests/createAsyncThunk.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { noop } from '@internal/listenerMiddleware/utils'
import { delay } from '@internal/utils'
import type { CreateAsyncThunkFunction, UnknownAction } from '@reduxjs/toolkit'
import {
configureStore,
createAsyncThunk,
createReducer,
unwrapResult,
miniSerializeError,
unwrapResult,
} from '@reduxjs/toolkit'
import { vi } from 'vitest'

import {
createConsole,
getLog,
mockConsole,
} from 'console-testing-library/pure'
import { delay } from '@internal/utils'

declare global {
interface Window {
@@ -498,23 +492,21 @@ describe('createAsyncThunk with abortController', () => {
describe('behavior with missing AbortController', () => {
let keepAbortController: (typeof window)['AbortController']
let freshlyLoadedModule: typeof import('../createAsyncThunk')
let restore: () => void = () => {}
let nodeEnv: string

beforeEach(async () => {
keepAbortController = window.AbortController
delete (window as any).AbortController
vi.resetModules()
freshlyLoadedModule = await import('../createAsyncThunk')
restore = mockConsole(createConsole())
nodeEnv = process.env.NODE_ENV!
;(process.env as any).NODE_ENV = 'development'
})

afterEach(() => {
;(process.env as any).NODE_ENV = nodeEnv
restore()
window.AbortController = keepAbortController
vi.unstubAllEnvs()
vi.clearAllMocks()
vi.stubGlobal('AbortController', keepAbortController)
vi.resetModules()
})

@@ -532,16 +524,17 @@ describe('createAsyncThunk with abortController', () => {
})

test('non-serializable arguments are ignored by serializableStateInvariantMiddleware', async () => {
const restore = mockConsole(createConsole())
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(noop)
const nonSerializableValue = new Map()
const asyncThunk = createAsyncThunk('test', (arg: Map<any, any>) => {})

configureStore({
reducer: () => 0,
}).dispatch(asyncThunk(nonSerializableValue))

expect(getLog().log).toMatchInlineSnapshot(`""`)
restore()
expect(consoleErrorSpy).not.toHaveBeenCalled()

consoleErrorSpy.mockRestore()
})

describe('conditional skipping of asyncThunks', () => {