From d57228a6513bb22cbb8c0659027d0f1556cbdc9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 8 Jul 2019 18:53:27 +0800 Subject: [PATCH] add test --- .eslintignore | 6 +++--- package.json | 15 +++++++++------ tests/__tests__/index.test.js | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 tests/__tests__/index.test.js diff --git a/.eslintignore b/.eslintignore index 3015390d..a0a4ac0b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,5 @@ -/functions/mock/** /scripts -/config **/node_modules/** -_scripts \ No newline at end of file +_scripts +/lambda/mock/** +_test_ \ No newline at end of file diff --git a/package.json b/package.json index e17fd506..b1fedd3a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "scripts": { - "dev": "cross-env PAGES_PATH='ListBasicList/src' umi dev", + "dev": "cross-env PAGES_PATH='AccountCenter/src' umi dev", "format-imports": "import-sort --write '**/*.{js,jsx,ts,tsx}'", "lint": "npm run lint:js && npm run lint:style", "lint-staged": "lint-staged", @@ -11,7 +11,8 @@ "lint:style": "stylelint --fix '**/*.less' --syntax less", "prettier": "prettier -c --write **/*", "screenshot": "block-screenshot", - "start": "umi dev" + "start": "umi dev", + "test": "umi test" }, "husky": { "hooks": { @@ -28,17 +29,19 @@ "**/*.{js,ts,tsx}": "npm run lint-staged:js" }, "dependencies": { + "@ant-design/pro-layout": "^4.5.10", "@types/react-dom": "^16.8.4", "antd": "3.20.0", - "block-screenshot": "^1.0.0", + "block-screenshot": "^1.0.1", "cross-env": "^5.2.0", "numeral": "^2.0.6", "react": "^16.8.6", "react-dom": "^16.8.6", - "umi": "^2.6.17", + "umi": "^2.8.9", "umi-plugin-block-dev": "2.2.0-beta.0", "umi-plugin-react": "^1.9.7", - "umi-request": "^1.0.0" + "umi-request": "^1.0.0", + "umi-utils": "^1.5.1" }, "devDependencies": { "@types/classnames": "^2.2.7", @@ -67,4 +70,4 @@ "**/*.less", "**/*.md" ] -} \ No newline at end of file +} diff --git a/tests/__tests__/index.test.js b/tests/__tests__/index.test.js new file mode 100644 index 00000000..a5e7c8a0 --- /dev/null +++ b/tests/__tests__/index.test.js @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +const diffImage = require('block-screenshot/src/screenshot'); +const path = require('path'); +const { winPath } = require('umi-utils'); + +jest.setTimeout(50000000); +describe('Pro Block', () => { + it('🥩 diff all block images', async () => { + const diffFileList = await diffImage({ + cwd: path.join(winPath(__dirname), '../../'), + diff: true, + }); + expect(diffFileList).toBe(0); + }); +});