Skip to content

Commit

Permalink
feat(test): support test mock RenderClient (#9556)
Browse files Browse the repository at this point in the history
* feat(test): support test mock RenderClient

* reset

* reset errorLog

* reset

* reset

* reset

* fix

* fix

* fix

* 减少更新

* 更好的代码写法

* 更好的代码

* 更好的代码

* 支持 g2的测试

* 默认转化所有的 es

* 默认转化所有的 es

* remove unuse code

* add docs

* remove unuse code

* remove unuse code

* rm act

* fix(plugin-layout): copy routes to children

* fix test

* fix test

* remove routest

* fix ci error

* fix

* fix test

* fix(plugin-layout): do not change default list

* fix(plugin-layout): do not change default list

* update

* up jest version

* update

* fix: remove dev proxy

* alway use mock data

* chore: remove unuse code

* update

* update

* merge

* merge master

* merge master
  • Loading branch information
chenshuai2144 authored Nov 3, 2022
1 parent 7f2230c commit c160f3c
Show file tree
Hide file tree
Showing 24 changed files with 2,137 additions and 927 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/node_modules
/examples/*/.esmi
/examples/*/.mfsu
/examples/*/.umi-test
/examples/*/.umi
/examples/*/.umi-production
/examples/*/.output
/examples/*/api
/examples/*/server
/examples/*/.umi-test
/examples/*/src/.umi
/examples/*/src/.umi-test
/examples/*/src/.umi-production
/examples/libs/monorepo/foo/.mfsu
/examples/libs/monorepo/foo/.umi
Expand Down
8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

11 changes: 11 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
printWidth: 80,
singleQuote: true,
trailingComma: "all",
proseWrap: "never",
overrides: [{ files: ".prettierrc", options: { parser: "json" } }],
plugins: [
require.resolve("prettier-plugin-packagejson"),
require.resolve("./scripts/prettier-plugin"),
],
};
1 change: 1 addition & 0 deletions examples/ant-design-pro/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { defineConfig } from 'umi';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
const { REACT_APP_ENV } = process.env;

export default defineConfig({
hash: true,
model: {},
Expand Down
22 changes: 22 additions & 0 deletions examples/ant-design-pro/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { configUmiAlias, createConfig } from '@umijs/max/test';

export default async () => {
const config = await configUmiAlias({
...createConfig({
target: 'browser',
}),
});
return {
...config,
testEnvironmentOptions: {
...(config?.testEnvironmentOptions || {}),
url: 'http://localhost:8000',
},
setupFiles: [...(config.setupFiles || []), './tests/setupTests.jsx'],
globals: {
...config.globals,
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false,
localStorage: null,
},
};
};
15 changes: 10 additions & 5 deletions examples/ant-design-pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,31 @@
"build": "max build",
"dev": "max dev",
"setup": "max setup",
"start": "npm run dev"
"start": "npm run dev",
"test": "jest"
},
"dependencies": {
"@ant-design/charts": "^1.3.6",
"@ant-design/charts": "^1.4.2",
"@ant-design/icons": "4.7.0",
"@ant-design/pro-components": "^2.0.1",
"@antv/l7-react": "^2.3.9",
"@testing-library/react": "^13.4.0",
"@umijs/max": "4.0.0-canary.20221028.1",
"ahooks": "^3.4.0",
"antd": "4.20.6",
"classnames": "^2.3.1",
"dayjs": "^1.11.2",
"dayjs": "^1.11.4",
"gg-editor": "3.1.3",
"jest": "^28.1.3",
"jest-environment-jsdom": "^28.1.3",
"jsdom-global": "^3.0.2",
"lodash": "^4.17.21",
"mockjs": "^1.1.0",
"moment": "^2.29.3",
"moment": "^2.29.4",
"monaco-editor": "^0.33.0",
"monaco-editor-webpack-plugin": "^7.0.1",
"numeral": "^2.0.6",
"querystring": "^0.2.1",
"rc-util": "^5.21.5"
"rc-util": "^5.22.5"
}
}
2 changes: 1 addition & 1 deletion examples/ant-design-pro/src/pages/result/fail/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CloseCircleOutlined, RightOutlined } from '@ant-design/icons';
import { GridContent } from '@ant-design/pro-components';
import { Button, Card, Result } from 'antd';
import { Fragment } from 'react';
import React, { Fragment } from 'react';
import styles from './index.less';

const Content = (
Expand Down
2 changes: 1 addition & 1 deletion examples/ant-design-pro/src/pages/result/success/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DingdingOutlined } from '@ant-design/icons';
import { GridContent } from '@ant-design/pro-components';
import { Button, Card, Descriptions, Result, Steps } from 'antd';
import { Fragment } from 'react';
import React, { Fragment } from 'react';
import styles from './index.less';

const { Step } = Steps;
Expand Down
Loading

0 comments on commit c160f3c

Please sign in to comment.