Skip to content

Commit

Permalink
test: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Aug 13, 2024
1 parent 903aca7 commit 53571a0
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 21,218 deletions.
24 changes: 10 additions & 14 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';

const basePath = process.env.GH_PAGES ? '/footer/' : '/';
const publicPath = process.env.GH_PAGES ? '/footer/' : '/';

export default defineConfig({
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
favicons: [
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
],
themeConfig: {
name: 'rc-footer',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
name: 'Footer',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'
},
outputPath: '.doc',
exportStatic: {},
base: '/footer/',
publicPath: '/footer/',
hash: true,
styles: [
`
.markdown table {
width: auto !important;
}
`,
],
base: basePath,
publicPath,
});
11 changes: 7 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
key: lock-${{ github.sha }}

- name: create package-lock.json
run: npm i --package-lock-only --ignore-scripts --legacy-peer-deps
run: npm i --package-lock-only --ignore-scripts

- name: hack for singe file
run: |
Expand All @@ -38,7 +38,7 @@ jobs:

- name: install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci --legacy-peer-deps
run: npm ci

lint:
runs-on: ubuntu-latest
Expand All @@ -59,7 +59,10 @@ jobs:
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: lint
run: npm run lint
run: npm run lint && npm run type:check

- name: type check
run: npm run type:check

needs: setup

Expand Down Expand Up @@ -105,7 +108,7 @@ jobs:
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: coverage
run: npm run coverage
run: npm test -- --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx pretty-quick --staged
18 changes: 15 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
module.exports = {
snapshotSerializers: [require.resolve('enzyme-to-json/serializer')],
};
import { createConfig, type Config } from '@umijs/test';

const defaultConfig = createConfig({
target: 'browser',
});

const config: Config.InitialOptions = {
...defaultConfig,
setupFilesAfterEnv: [
...(defaultConfig.setupFilesAfterEnv || []),
'./tests/setupFilesAfterEnv.ts'
],
}

export default config;
48 changes: 23 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,53 +30,51 @@
"license": "MIT",
"scripts": {
"start": "dumi dev",
"type:check": "tsc --noEmit",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d .doc",
"compile": "father build && lessc assets/index.less assets/index.css",
"prepare": "husky install && dumi setup",
"gh-pages": "npm run docs:build && father doc deploy",
"gh-pages": "GH_PAGES=1 npm run docs:build && npm run docs:deploy",
"prepublishOnly": "npm run compile && np --yolo --no-publish && npm run gh-pages",
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
"pretty-quick": "pretty-quick",
"test": "rc-test",
"coverage": "rc-test --coverage"
"test": "jest",
"coverage": "jest --coverage",
"prepare": "husky install"
},
"dependencies": {
"@babel/runtime": "^7.11.1",
"classnames": "^2.2.1"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
"@rc-component/father-plugin": "^1.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.2.1",
"@types/classnames": "^2.2.9",
"@types/enzyme": "^3.10.18",
"@types/jest": "^29.5.12",
"@types/jest": "^29.2.4",
"@types/react": "^17.0.13",
"@types/react-dom": "^16.9.0",
"@umijs/fabric": "^2.0.8",
"cheerio": "1.0.0-rc.12",
"cross-env": "^7.0.2",
"dumi": "^2.0.0",
"enzyme": "^3.0.0",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.4.0",
"@umijs/fabric": "^3.0.0",
"@umijs/test": "^4.0.36",
"coveralls": "^3.0.6",
"cross-env": "^7.0.3",
"cssstyle": "^2.3.0",
"dumi": "^2.1.2",
"eslint": "^7.0.0",
"father": "^4.0.0",
"father": "^4.1.1",
"gh-pages": "^3.1.0",
"glob": "^10.0.0",
"husky": "^8.0.3",
"husky": "^8.0.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"less": "^3.10.3",
"np": "^7.0.0",
"prettier": "^2.0.5",
"pretty-quick": "^3.0.0",
"rc-test": "^7.0.15",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"typescript": "^5.2.2"
},
"peerDependencies": {
"react": ">=16.0.0",
"react-dom": ">=16.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0",
"ts-node": "^10.9.1",
"typescript": "^5.3.0"
},
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit 53571a0

Please sign in to comment.