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

[core] Remove /test-utils #21855

Merged
merged 1 commit into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 2 additions & 24 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ module.exports = {
'no-restricted-imports': [
'error',
{
patterns: [
'@material-ui/*/*/*',
'!@material-ui/core/test-utils/*',
'!@material-ui/utils/macros/*.macro',
],
patterns: ['@material-ui/*/*/*', '!@material-ui/utils/macros/*.macro'],
},
],
'no-constant-condition': 'error',
Expand Down Expand Up @@ -87,7 +83,6 @@ module.exports = {
overrides: [
{
files: [
'**/test-utils/**/*.js',
// matching the pattern of the test runner
'*.test.js',
],
Expand All @@ -98,19 +93,6 @@ module.exports = {
rules: {
// does not work with wildcard imports. Mistakes will throw at runtime anyway
'import/named': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@material-ui/core/test-utils',
importNames: ['createMount'],
message:
"Please use `import createMount from 'test/utils/createMount'` instead. `createMount` from /core has cleanup issues that require breaking changes.",
},
],
},
],

'material-ui/disallow-active-element-as-key-event-target': 'error',

Expand Down Expand Up @@ -176,11 +158,7 @@ module.exports = {
'no-restricted-imports': [
'error',
{
patterns: [
'@material-ui/*/*/*/*',
'!@material-ui/core/test-utils/*',
'!@material-ui/utils/macros/*.macro',
],
patterns: ['@material-ui/*/*/*/*', '!@material-ui/utils/macros/*.macro'],
},
], // Allow deeper imports for TypeScript types. TODO?
'react/prop-types': 'off',
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-codemod/src/v4.0.0/optimal-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function transformer(fileInfo, api, options) {

const subpath = match[1].replace(/\/$/, '');

if (/^(internal|test-utils)/.test(subpath)) return;
if (/^(internal)/.test(subpath)) return;
const targetImportPath = `${targetModule}/${subpath}`;

const whitelist = getJSExports(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,3 @@ import ListSubheader from '@material-ui/core/ListSubheader';
import TableContext from '@material-ui/core/Table/TableContext';
import TabScrollButton from '@material-ui/core/Tabs/TabScrollButton';
import SwitchBase from '@material-ui/core/internal/SwitchBase';
import createMount from '@material-ui/core/test-utils/createMount';
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ import ListSubheader from '@material-ui/core/ListSubheader';
import TableContext from '@material-ui/core/Table/TableContext';
import TabScrollButton from '@material-ui/core/Tabs/TabScrollButton';
import SwitchBase from '@material-ui/core/internal/SwitchBase';
import createMount from '@material-ui/core/test-utils/createMount';
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/Alert/Alert.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import Paper from '@material-ui/core/Paper';
import Alert from './Alert';

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/AlertTitle/AlertTitle.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import AlertTitle from './AlertTitle';

describe('<AlertTitle />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { expect } from 'chai';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import { spy } from 'sinon';
import { act, createClientRender, fireEvent, screen } from 'test/utils/createClientRender';
import TextField from '@material-ui/core/TextField';
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/AvatarGroup/AvatarGroup.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { expect } from 'chai';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import { createClientRender } from 'test/utils/createClientRender';
import Avatar from '@material-ui/core/Avatar';
import AvatarGroup from './AvatarGroup';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import Button from '@material-ui/core/Button';
import LoadingButton from './LoadingButton';

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/Pagination/Pagination.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import { createClientRender } from 'test/utils/createClientRender';
import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles';
import Pagination from './Pagination';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { expect } from 'chai';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import { createClientRender } from 'test/utils/createClientRender';
import PaginationItem from './PaginationItem';

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/Rating/Rating.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { expect } from 'chai';
import { stub, spy } from 'sinon';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import { createClientRender, fireEvent } from 'test/utils/createClientRender';
import Rating from './Rating';

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/Skeleton/Skeleton.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { expect } from 'chai';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import { createClientRender } from 'test/utils/createClientRender';
import Skeleton from './Skeleton';

Expand Down
8 changes: 2 additions & 6 deletions packages/material-ui-lab/src/SpeedDial/SpeedDial.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import {
findOutermostIntrinsic,
getClasses,
wrapsIntrinsicElement,
} from '@material-ui/core/test-utils';
import { findOutermostIntrinsic, getClasses, wrapsIntrinsicElement } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import Icon from '@material-ui/core/Icon';
import Fab from '@material-ui/core/Fab';
import SpeedDial from './SpeedDial';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as React from 'react';
import { expect } from 'chai';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import { useFakeTimers } from 'sinon';
import createMount from 'test/utils/createMount';
import { act, createClientRender, fireEvent } from 'test/utils/createClientRender';
import Icon from '@material-ui/core/Icon';
import Tooltip from '@material-ui/core/Tooltip';
import Fab from '@material-ui/core/Fab';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import SpeedDialAction from './SpeedDialAction';

describe('<SpeedDialAction />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { expect } from 'chai';
import { getClasses, findOutermostIntrinsic } from '@material-ui/core/test-utils';
import { getClasses, findOutermostIntrinsic } from 'test/utils';
import createMount from 'test/utils/createMount';
import Icon from '@material-ui/core/Icon';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import SpeedDialIcon from './SpeedDialIcon';

describe('<SpeedDialIcon />', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/TabList/TabList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender } from 'test/utils/createClientRender';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import Tab from '@material-ui/core/Tab';
import Tabs from '@material-ui/core/Tabs';
import TabList from './TabList';
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/TabPanel/TabPanel.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @ts-check
import * as React from 'react';
import { expect } from 'chai';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import { createClientRender } from 'test/utils/createClientRender';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import TabPanel from './TabPanel';
import TabContext from '../TabContext';

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/Timeline/Timeline.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import Timeline from './Timeline';

describe('<Timeline />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import TimelineConnector from './TimelineConnector';

describe('<TimelineConnector />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import Typography from '@material-ui/core/Typography';
import TimelineContent from './TimelineContent';

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/TimelineDot/TimelineDot.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import TimelineDot from './TimelineDot';

describe('<TimelineDot />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import TimelineItem from './TimelineItem';

describe('<TimelineItem />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import Typography from '@material-ui/core/Typography';
import TimelineOppositeContent from './TimelineOppositeContent';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import TimelineSeparator from './TimelineSeparator';

describe('<TimelineSeparator />', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { expect } from 'chai';
import { spy } from 'sinon';
import { createClientRender } from 'test/utils/createClientRender';
import createServerRender from 'test/utils/createServerRender';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import ButtonBase from '@material-ui/core/ButtonBase';
import ToggleButton from './ToggleButton';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import { createClientRender } from 'test/utils/createClientRender';
import ToggleButtonGroup from './ToggleButtonGroup';
import ToggleButton from '../ToggleButton';
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/TreeItem/TreeItem.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import { getClasses } from '@material-ui/core/test-utils';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import {
act,
createEvent,
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/TreeView/TreeView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { expect } from 'chai';
import { spy } from 'sinon';
import { createClientRender, fireEvent, screen } from 'test/utils/createClientRender';
import { ErrorBoundary } from 'test/utils/components';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import { getClasses } from '@material-ui/core/test-utils';
import describeConformance from 'test/utils/describeConformance';
import { getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import TreeView from './TreeView';
import TreeItem from '../TreeItem';
Expand Down
4 changes: 1 addition & 3 deletions packages/material-ui/src/Accordion/Accordion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import { expect } from 'chai';
import { spy } from 'sinon';
import { getClasses, findOutermostIntrinsic } from '@material-ui/core/test-utils';
import createMount from 'test/utils/createMount';
import describeConformance from '../test-utils/describeConformance';
import { createMount, describeConformance, getClasses, findOutermostIntrinsic } from 'test/utils';
import Paper from '../Paper';
import Accordion from './Accordion';
import AccordionSummary from '../AccordionSummary';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import { getClasses } from '@material-ui/core/test-utils';
import createMount from 'test/utils/createMount';
import describeConformance from '../test-utils/describeConformance';
import { getClasses, createMount, describeConformance } from 'test/utils';

import AccordionActions from './AccordionActions';

describe('<AccordionActions />', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { expect } from 'chai';
import { createShallow, getClasses } from '@material-ui/core/test-utils';
import { createShallow, getClasses } from 'test/utils';
import createMount from 'test/utils/createMount';
import describeConformance from '../test-utils/describeConformance';
import describeConformance from 'test/utils/describeConformance';
import AccordionDetails from './AccordionDetails';

describe('<AccordionDetails />', () => {
Expand Down
Loading