Skip to content

Commit e1e2b60

Browse files
authored
Merge pull request #5679 from marmelab/upgrade-test-dependencies
Upgrade test dependencies
2 parents e46c682 + f2bcad1 commit e1e2b60

File tree

104 files changed

+1729
-427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1729
-427
lines changed

examples/demo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"devDependencies": {
4747
"@types/fetch-mock": "^7.3.2",
4848
"@types/classnames": "^2.2.9",
49-
"@types/jest": "^24.0.23",
49+
"@types/jest": "^26.0.19",
5050
"@types/node": "^12.12.14",
5151
"@types/query-string": "5.1.0",
5252
"@types/react": "^16.9.13",

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
}
4242
},
4343
"devDependencies": {
44-
"@types/jest": "^24.0.13",
44+
"@types/jest": "^26.0.19",
4545
"@types/react": "^16.9.0",
4646
"@types/react-redux": "^7.1.1",
4747
"@typescript-eslint/eslint-plugin": "^3.10.1",
@@ -63,14 +63,14 @@
6363
"express": "~4.16.3",
6464
"full-icu": "~1.3.1",
6565
"husky": "^2.3.0",
66-
"jest": "^24.7.0",
66+
"jest": "^26.6.3",
6767
"lerna": "~2.9.1",
6868
"lint-staged": "^8.1.7",
6969
"lolex": "~2.3.2",
7070
"mutationobserver-shim": "^0.3.3",
7171
"prettier": "~2.1.1",
7272
"raf": "~3.4.1",
73-
"ts-jest": "^24.0.0",
73+
"ts-jest": "^26.4.4",
7474
"wait-on": "^3.2.0",
7575
"whatwg-fetch": "^3.0.0"
7676
},
@@ -82,4 +82,4 @@
8282
"dependencies": {
8383
"typescript": "^4.0.2"
8484
}
85-
}
85+
}

packages/ra-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"redux-saga": "^1.0.0"
6666
},
6767
"dependencies": {
68-
"@testing-library/react": "^8.0.7",
68+
"@testing-library/react": "^11.2.2",
6969
"classnames": "~2.2.5",
7070
"date-fns": "^1.29.0",
7171
"eventemitter3": "^3.0.0",

packages/ra-core/src/auth/Authenticated.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import expect from 'expect';
3-
import { cleanup, wait } from '@testing-library/react';
3+
import { wait } from '@testing-library/react';
44

55
import Authenticated from './Authenticated';
66
import AuthContext from './AuthContext';
@@ -10,8 +10,6 @@ import { createMemoryHistory } from 'history';
1010
import { Router } from 'react-router-dom';
1111

1212
describe('<Authenticated>', () => {
13-
afterEach(cleanup);
14-
1513
const Foo = () => <div>Foo</div>;
1614

1715
it('should render its child by default', async () => {

packages/ra-core/src/auth/useAuthState.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import expect from 'expect';
3-
import { cleanup, wait } from '@testing-library/react';
3+
import { wait } from '@testing-library/react';
44

55
import useAuthState from './useAuthState';
66
import AuthContext from './AuthContext';
@@ -20,8 +20,6 @@ const stateInpector = state => (
2020
);
2121

2222
describe('useAuthState', () => {
23-
afterEach(cleanup);
24-
2523
it('should return a loading state on mount', () => {
2624
const { queryByText } = renderWithRedux(
2725
<UseAuth>{stateInpector}</UseAuth>

packages/ra-core/src/auth/useAuthenticated.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import expect from 'expect';
3-
import { cleanup, wait } from '@testing-library/react';
3+
import { wait } from '@testing-library/react';
44

55
import Authenticated from './Authenticated';
66
import AuthContext from './AuthContext';
@@ -10,8 +10,6 @@ import { createMemoryHistory } from 'history';
1010
import { Router } from 'react-router-dom';
1111

1212
describe('useAuthenticated', () => {
13-
afterEach(cleanup);
14-
1513
const Foo = () => <div>Foo</div>;
1614

1715
it('should call authProvider on mount', () => {

packages/ra-core/src/auth/useCheckAuth.spec.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { useState, useEffect } from 'react';
33
import expect from 'expect';
4-
import { render, cleanup, wait } from '@testing-library/react';
4+
import { render, wait } from '@testing-library/react';
55

66
import useCheckAuth from './useCheckAuth';
77
import AuthContext from './AuthContext';
@@ -60,7 +60,6 @@ describe('useCheckAuth', () => {
6060
afterEach(() => {
6161
logout.mockClear();
6262
notify.mockClear();
63-
cleanup();
6463
});
6564

6665
it('should not logout if has credentials', async () => {

packages/ra-core/src/auth/useLogoutIfAccessDenied.spec.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { useState, useEffect } from 'react';
33
import expect from 'expect';
4-
import { render, cleanup, wait } from '@testing-library/react';
4+
import { render, wait } from '@testing-library/react';
55

66
import useLogoutIfAccessDenied from './useLogoutIfAccessDenied';
77
import AuthContext from './AuthContext';
@@ -55,7 +55,6 @@ describe('useLogoutIfAccessDenied', () => {
5555
afterEach(() => {
5656
logout.mockClear();
5757
notify.mockClear();
58-
cleanup();
5958
});
6059

6160
it('should not logout if passed no error', async () => {

packages/ra-core/src/auth/usePermissions.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import expect from 'expect';
3-
import { cleanup, wait } from '@testing-library/react';
3+
import { wait } from '@testing-library/react';
44

55
import usePermissions from './usePermissions';
66
import AuthContext from './AuthContext';
@@ -21,8 +21,6 @@ const stateInpector = state => (
2121
);
2222

2323
describe('usePermissions', () => {
24-
afterEach(cleanup);
25-
2624
it('should return a loading state on mount', () => {
2725
const { queryByText } = renderWithRedux(
2826
<UsePermissions>{stateInpector}</UsePermissions>

packages/ra-core/src/controller/details/useCreateController.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import expect from 'expect';
3-
import { act, cleanup } from '@testing-library/react';
3+
import { act } from '@testing-library/react';
44

55
import { getRecord } from './useCreateController';
66
import { CreateController } from './CreateController';
@@ -9,8 +9,6 @@ import { DataProviderContext } from '../../dataProvider';
99
import { DataProvider } from '../../types';
1010

1111
describe('useCreateController', () => {
12-
afterEach(cleanup);
13-
1412
describe('getRecord', () => {
1513
const location = {
1614
pathname: '/foo',

packages/ra-core/src/controller/details/useEditController.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import * as React from 'react';
22
import expect from 'expect';
3-
import { act, cleanup, wait } from '@testing-library/react';
3+
import { act, wait } from '@testing-library/react';
44

55
import { EditController } from './EditController';
66
import renderWithRedux from '../../util/renderWithRedux';
77
import { DataProviderContext } from '../../dataProvider';
88
import { DataProvider } from '../../types';
99

1010
describe('useEditController', () => {
11-
afterEach(cleanup);
12-
1311
const defaultProps = {
1412
basePath: '',
1513
hasCreate: true,

packages/ra-core/src/controller/field/ReferenceArrayFieldController.spec.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import * as React from 'react';
2-
import { cleanup } from '@testing-library/react';
32
import expect from 'expect';
43

54
import ReferenceArrayFieldController from './ReferenceArrayFieldController';
65
import { DataProviderContext } from '../../dataProvider';
76
import renderWithRedux from '../../util/renderWithRedux';
87

98
describe('<ReferenceArrayFieldController />', () => {
10-
afterEach(cleanup);
119
it('should set the loaded prop to false when related records are not yet fetched', () => {
1210
const children = jest.fn().mockReturnValue('child');
1311

packages/ra-core/src/controller/field/ReferenceFieldController.spec.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import { cleanup } from '@testing-library/react';
32
import expect from 'expect';
43

54
import ReferenceFieldController from './ReferenceFieldController';
@@ -13,7 +12,6 @@ const defaultState = {
1312
};
1413

1514
describe('<ReferenceFieldController />', () => {
16-
afterEach(cleanup);
1715
it('should call the CRUD_GET_MANY action on mount if reference source is defined', async () => {
1816
const dataProvider = {
1917
getMany: jest.fn(() =>

packages/ra-core/src/controller/field/ReferenceManyFieldController.spec.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import * as React from 'react';
2-
import { cleanup, wait } from '@testing-library/react';
2+
import { wait } from '@testing-library/react';
33
import expect from 'expect';
44

55
import ReferenceManyFieldController from './ReferenceManyFieldController';
66
import renderWithRedux from '../../util/renderWithRedux';
77

88
describe('<ReferenceManyFieldController />', () => {
9-
afterEach(cleanup);
109
it('should set loaded to false when related records are not yet fetched', async () => {
1110
const children = jest.fn().mockReturnValue('children');
1211
const { dispatch } = renderWithRedux(

packages/ra-core/src/controller/input/ReferenceArrayInputController.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import expect from 'expect';
3-
import { cleanup, wait, fireEvent } from '@testing-library/react';
3+
import { wait, fireEvent } from '@testing-library/react';
44
import ReferenceArrayInputController from './ReferenceArrayInputController';
55
import { renderWithRedux } from '../../util';
66
import { CRUD_GET_MATCHING, CRUD_GET_MANY } from '../../../lib';
@@ -15,8 +15,6 @@ describe('<ReferenceArrayInputController />', () => {
1515
source: 'tag_ids',
1616
};
1717

18-
afterEach(cleanup);
19-
2018
it('should set loading to true as long as there are no references fetched and no selected references', () => {
2119
const children = jest.fn(({ loading }) => (
2220
<div>{loading.toString()}</div>

packages/ra-core/src/controller/input/ReferenceInputController.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { useState, useCallback } from 'react';
3-
import { cleanup, fireEvent, wait } from '@testing-library/react';
3+
import { fireEvent, wait } from '@testing-library/react';
44
import omit from 'lodash/omit';
55
import expect from 'expect';
66

@@ -19,8 +19,6 @@ describe('<ReferenceInputController />', () => {
1919
source: 'post_id',
2020
};
2121

22-
afterEach(cleanup);
23-
2422
const dataProvider = {
2523
getMany: jest.fn(() =>
2624
Promise.resolve({ data: [{ id: 1, title: 'foo' }] })

packages/ra-core/src/controller/input/useGetMatchingReferences.spec.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import renderHook from '../../util/renderHook';
22
import useMatchingReferences from './useGetMatchingReferences';
3-
import { cleanup } from '@testing-library/react';
43

54
describe('useMatchingReferences', () => {
65
const defaultProps = {
@@ -16,8 +15,6 @@ describe('useMatchingReferences', () => {
1615
referenceSource: undefined,
1716
};
1817

19-
afterEach(cleanup);
20-
2118
it('should fetch matchingReferences only on mount', () => {
2219
const { dispatch } = renderHook(
2320
() => {

packages/ra-core/src/controller/useListContext.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import * as React from 'react';
22
import expect from 'expect';
3-
import { render, cleanup } from '@testing-library/react';
3+
import { render } from '@testing-library/react';
44

55
import ListContext from './ListContext';
66
import useListContext from './useListContext';
77

88
describe('useListContext', () => {
9-
afterEach(cleanup);
10-
119
const NaiveList = props => {
1210
const { ids, data } = useListContext(props);
1311
return (

packages/ra-core/src/controller/useListController.spec.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import expect from 'expect';
3-
import { fireEvent, wait, cleanup } from '@testing-library/react';
3+
import { fireEvent, wait } from '@testing-library/react';
44
import lolex from 'lolex';
55
import TextField from '@material-ui/core/TextField/TextField';
66

@@ -205,7 +205,6 @@ describe('useListController', () => {
205205

206206
afterEach(() => {
207207
clock.uninstall();
208-
cleanup();
209208
});
210209
});
211210
describe('showFilter', () => {

packages/ra-core/src/controller/useReference.spec.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import { cleanup } from '@testing-library/react';
32
import expect from 'expect';
43

54
import renderWithRedux from '../util/renderWithRedux';
@@ -18,8 +17,6 @@ describe('useReference', () => {
1817
reference: 'posts',
1918
};
2019

21-
afterEach(cleanup);
22-
2320
it('should fetch reference on mount', async () => {
2421
const dataProvider = {
2522
getMany: jest.fn(() =>

packages/ra-core/src/core/CoreAdminRouter.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { cleanup, wait } from '@testing-library/react';
2+
import { wait } from '@testing-library/react';
33
import expect from 'expect';
44
import { Router, Route } from 'react-router-dom';
55
import { createMemoryHistory } from 'history';
@@ -12,8 +12,6 @@ import Resource from './Resource';
1212
const Layout = ({ children }) => <div>Layout {children}</div>;
1313

1414
describe('<CoreAdminRouter>', () => {
15-
afterEach(cleanup);
16-
1715
const defaultProps = {
1816
customRoutes: [],
1917
};

packages/ra-core/src/core/Resource.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import expect from 'expect';
3-
import { cleanup, wait } from '@testing-library/react';
3+
import { wait } from '@testing-library/react';
44
import { Router } from 'react-router-dom';
55
import { createMemoryHistory } from 'history';
66

@@ -26,8 +26,6 @@ const resource = {
2626
};
2727

2828
describe('<Resource>', () => {
29-
afterEach(cleanup);
30-
3129
it(`registers its resource in redux on mount when context is 'registration'`, () => {
3230
const { dispatch } = renderWithRedux(
3331
<Resource {...resource} intent="registration" />

packages/ra-core/src/core/RoutesWithLayout.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ import * as React from 'react';
22
import { Route, MemoryRouter } from 'react-router-dom';
33
import { createStore } from 'redux';
44
import { Provider } from 'react-redux';
5-
import { render, cleanup } from '@testing-library/react';
5+
import { render } from '@testing-library/react';
66

77
import RoutesWithLayout from './RoutesWithLayout';
88

99
describe('<RoutesWithLayout>', () => {
10-
afterEach(cleanup);
11-
1210
const Dashboard = () => <div>Dashboard</div>;
1311
const Custom = ({ name }) => <div>Custom</div>;
1412
const FirstResource = ({ name }) => <div>Default</div>;

packages/ra-core/src/dataProvider/Mutation.spec.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
22
import {
3-
cleanup,
43
fireEvent,
54
waitForDomChange,
65
act,
@@ -17,8 +16,6 @@ import { useNotify } from '../sideEffect';
1716
import { History } from 'history';
1817

1918
describe('Mutation', () => {
20-
afterEach(cleanup);
21-
2219
it('should render its child function', () => {
2320
const { getByTestId } = renderWithRedux(
2421
<Mutation type="foo" resource="bar">

0 commit comments

Comments
 (0)