-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from ant-design/fix/tslint
test: init test config and add ci workflow
- Loading branch information
Showing
12 changed files
with
3,741 additions
and
4,118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 16.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: ci | ||
run: | | ||
npm i pnpm -g | ||
pnpm install | ||
pnpm run ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,33 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
// preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testMatch: ['<rootDir>/packages/**/*.test.ts'], | ||
testEnvironment: 'jsdom', | ||
testMatch: ['<rootDir>/packages/**/*.test.(ts|tsx)'], | ||
testPathIgnorePatterns: ['/node_modules/'], | ||
testTimeout: 3e4, | ||
transformIgnorePatterns: [`/node_modules/(?!${[].join('|')})`], | ||
transform: { | ||
'^.+\\.ts$': [ | ||
'^.+\\.(ts|tsx)$': [ | ||
'@swc/jest', | ||
{ | ||
jsc: { | ||
// config doc: https://swc.rs/docs/configuration/compilation | ||
parser: { | ||
syntax: 'typescript', | ||
decorators: true, | ||
dynamicImport: true, | ||
}, | ||
transform: null, | ||
transform: { | ||
react: { | ||
runtime: 'automatic', | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
// '^.+\\.ts$': ['ts-jest', { diagnostics: false }], | ||
}, | ||
setupFiles: ['<rootDir>/scripts/jest-setup.js'], | ||
setupFiles: ['<rootDir>/tests/setup.js'], | ||
collectCoverageFrom: ['<rootDir>/packages/*/src/**/*.ts'], | ||
coveragePathIgnorePatterns: ['/node_modules/', '/(.*)mock(.*)/'], | ||
reporters: ['default', ['jest-junit', { outputDirectory: 'coverage' }]], | ||
coverageReporters: [ | ||
// 'clover', | ||
// 'json', | ||
'json-summary', | ||
['text', { skipFull: true }], | ||
'cobertura', | ||
// 'html-spa', | ||
], | ||
coverageReporters: ['json-summary', ['text', { skipFull: true }], 'cobertura'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,14 +16,15 @@ | |
"release": "changeset version && changeset publish", | ||
"release:alpha": "changeset version --snapshot alpha && changeset publish --tag alpha", | ||
"release:beta": "changeset version --snapshot beta && changeset publish --tag beta", | ||
"ci": "npm run lint:eslint && npm run lint:prettier && npm run test:ci", | ||
"ci": "npm run lint && npm run test:ci && npm run build", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage", | ||
"test:watch": "jest --watch", | ||
"test:ci": "jest --coverage --maxWorkers=4 --forceExit", | ||
"lint": "pnpm run \"/^lint:.+/\"", | ||
"lint:eslint": "eslint --quiet --fix --ext .ts,.js .", | ||
"lint:prettier": "prettier --loglevel warn --write '**/*.{ts,tsx,js,jsx,json,md}'", | ||
"lint:ts": "tsc --noEmit", | ||
"clean": "pnpm run \"/^clean:.+/\"", | ||
"clean:module": "rimraf --glob ./node_modules ./packages/*/node_modules ./examples/*/node_modules", | ||
"clean:dist": "rimraf --glob ./packages/*/dist ./examples/*/dist", | ||
|
@@ -40,14 +41,17 @@ | |
"@changesets/cli": "^2.26.1", | ||
"@swc/core": "^1.3.61", | ||
"@swc/jest": "^0.2.26", | ||
"@testing-library/react": "^14.0.0", | ||
"@types/jest": "^29.5.1", | ||
"@types/node": "^16.6.1", | ||
"@types/react": "^18.2.20", | ||
"@umijs/fabric": "^2.14.1", | ||
"dumi": "^2.2.6", | ||
"eslint": "^7.32.0", | ||
"father": "^4.1.9", | ||
"husky": "^8.0.3", | ||
"jest": "^29.5.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"jest-junit": "^16.0.0", | ||
"lint-staged": "^13.2.2", | ||
"prettier": "^2.8.8", | ||
|
@@ -63,8 +67,5 @@ | |
"engines": { | ||
"node": ">=16" | ||
}, | ||
"repository": "[email protected]:antchain-fe/ant-design-web3.git", | ||
"dependencies": { | ||
"@types/react": "^18.2.20" | ||
} | ||
"repository": "[email protected]:antchain-fe/ant-design-web3.git" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ConnectButton } from '..'; | ||
import { render } from '@testing-library/react'; | ||
|
||
describe('ConnectButton', () => { | ||
it('mount correctly', () => { | ||
expect(() => render(<ConnectButton />)).not.toThrow(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.