Skip to content

Commit 032765b

Browse files
committed
Remove unnecessary JSDOM environment comments from test files and clean up imports in various test cases.
1 parent 5ad81d6 commit 032765b

File tree

11 files changed

+56
-4321
lines changed

11 files changed

+56
-4321
lines changed

.eslintrc.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module.exports = {
2-
extends: [require.resolve('@umijs/fabric/dist/eslint')],
32
rules: {
4-
'@typescript-eslint/consistent-type-imports': 'off',
3+
'no-console': 'off', // Allow console statements
54
},
65
};

package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,12 @@
134134
"@octokit/core": "^3.6.0",
135135
"@octokit/rest": "^18.12.0",
136136
"@testing-library/dom": "^10.4.0",
137-
"@testing-library/jest-dom": "^6.6.3",
138137
"@testing-library/react": "^16.3.0",
139138
"@testing-library/react-hooks": "^8.0.1",
140139
"@testing-library/user-event": "^14.6.1",
141140
"@types/chroma-js": "^2.4.5",
142141
"@types/glob": "^8.1.0",
143142
"@types/history": "^4.7.11",
144-
"@types/jsdom": "^21.1.7",
145143
"@types/lodash": "^4.17.17",
146144
"@types/lodash-es": "^4.17.12",
147145
"@types/mockjs": "^1.0.10",
@@ -154,7 +152,6 @@
154152
"@types/warning": "^3.0.3",
155153
"@umijs/babel-preset-umi": "^3.5.43",
156154
"@umijs/doctor": "^1.2.1",
157-
"@umijs/fabric": "^4.0.1",
158155
"@umijs/plugin-analytics": "^0.2.4",
159156
"@umijs/test": "^3.5.43",
160157
"@umijs/test-utils": "^3.5.43",
@@ -178,7 +175,6 @@
178175
"dumi-theme-antd-style": "~0.31.1",
179176
"esbuild": "^0.15.18",
180177
"eslint": "^8.57.1",
181-
"eslint-plugin-jest": "^27.9.0",
182178
"eslint-plugin-react": "^7.37.5",
183179
"eslint-plugin-react-hooks": "^4.6.2",
184180
"eslint-plugin-unicorn": "^47.0.0",
@@ -192,9 +188,6 @@
192188
"identity-obj-proxy": "^3.0.0",
193189
"inquirer": "^8.2.6",
194190
"jest-canvas-mock": "^2.5.2",
195-
"jest-fetch-mock": "^3.0.3",
196-
"jsdom": "^26.1.0",
197-
"lerna": "^3.22.1",
198191
"lint-staged": "^10.5.4",
199192
"lodash-es": "^4.17.21",
200193
"mockdate": "^3.0.5",

pnpm-lock.yaml

Lines changed: 50 additions & 4269 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/form/base.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* @vitest-environment jsdom
3-
*/
4-
51
import { FontSizeOutlined } from '@ant-design/icons';
62
import type { ProFormInstance } from '@ant-design/pro-components';
73
import {

tests/form/drawerForm.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* @vitest-environment jsdom
3-
*/
4-
5-
import { DrawerForm, ModalForm, ProFormText } from '@ant-design/pro-components';
1+
import { DrawerForm, ModalForm, ProFormText } from '@ant-design/pro-components';
62
import {
73
cleanup,
84
fireEvent,

tests/form/modalForm.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* @vitest-environment jsdom
3-
*/
4-
5-
import { ModalForm, ProFormText } from '@ant-design/pro-components';
1+
import { ModalForm, ProFormText } from '@ant-design/pro-components';
62
import {
73
act,
84
cleanup,

tests/form/schemaForm.test.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
/**
2-
* @vitest-environment jsdom
3-
*/
4-
5-
import type {
1+
import type {
62
ProFormColumnsType,
73
ProFormLayoutType,
84
} from '@ant-design/pro-components';
9-
import { BetaSchemaForm } from '@ant-design/pro-components';
10-
import { ProProvider } from '@ant-design/pro-provider';
5+
import { BetaSchemaForm, ProProvider } from '@ant-design/pro-components';
116
import {
127
cleanup,
138
fireEvent,

tests/layout/index.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* @vitest-environment jsdom
3-
*/
4-
51
import {
62
GithubFilled,
73
InfoCircleFilled,

tests/layout/settingDrawer.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* @vitest-environment jsdom
3-
*/
4-
51
import { SettingDrawer } from '@ant-design/pro-components';
62
import { cleanup, fireEvent, render, waitFor } from '@testing-library/react';
73
import { act } from 'react';

tests/setupTests.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
/* eslint-disable react/no-is-mounted */
2-
import '@testing-library/jest-dom';
3-
import { defaultConfig } from 'antd/lib/theme/internal';
1+
import { defaultConfig } from 'antd/lib/theme/internal';
42
import crypto from 'crypto';
53
import MockDate from 'mockdate';
64
import React from 'react';
75
import { vi } from 'vitest';
8-
import tableData from './table/mock.data.json';
96

107
defaultConfig.hashed = false;
118
globalThis.React = React;
@@ -134,10 +131,3 @@ globalThis.getComputedStyle = (elt) => getComputedStyle(elt);
134131
// with jest-canvas-mock
135132
(globalThis as any).jest = vi;
136133
await import('jest-canvas-mock');
137-
138-
// with jest-fetch-mock
139-
(await import('jest-fetch-mock')).enableFetchMocks();
140-
//@ts-ignore
141-
fetch.mockResponse(async () => {
142-
return { body: JSON.stringify(tableData) };
143-
});

0 commit comments

Comments
 (0)