chore(test): merge semantic tests into jest and drop dedicated config (#56795)

* chore(test): merge semantic tests into jest and drop dedicated config

* chore(test): simplify SKIP_SEMANTIC env check
This commit is contained in:
高艳兵
2026-01-29 15:30:07 +08:00
committed by GitHub
parent 3073cf188d
commit 93fb6c35e2
4 changed files with 6 additions and 42 deletions

View File

@@ -34,6 +34,7 @@ jobs:
shard: [1/2, 2/2]
env:
REACT: ${{ matrix.react }}
SKIP_SEMANTIC: '1'
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
@@ -52,15 +53,6 @@ jobs:
- run: ut
- run: ut test:node
test-semantic:
name: test-semantic
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- uses: utooland/setup-utoo@v1
- run: ut
- run: ut test:semantic
test-react-latest:
name: test-react-latest
strategy:

View File

@@ -34,6 +34,10 @@ function getTestRegex(libDir) {
return '.*\\.test\\.(j|t)sx?$';
}
const shouldIgnoreSemantic =
['dist', 'lib', 'es', 'dist-min'].includes(process.env.LIB_DIR) ||
['1', 'true'].includes(process.env.SKIP_SEMANTIC);
module.exports = {
verbose: true,
testEnvironment: 'jsdom',
@@ -54,7 +58,7 @@ module.exports = {
'node',
'image.test.js',
'image.test.ts',
'demo-semantic.test',
...(shouldIgnoreSemantic ? ['demo-semantic.test'] : []),
],
transform: {
'\\.tsx?$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor',

View File

@@ -1,30 +0,0 @@
const { moduleNameMapper, transformIgnorePatterns } = require('./.jest');
// jest config for semantic demo snapshots
// Semantic tests don't need to run in React 18, 19, lib, es, dist repeatedly
module.exports = {
verbose: true,
testEnvironment: 'jsdom',
setupFiles: ['./tests/setup.ts', 'jest-canvas-mock'],
setupFilesAfterEnv: ['./tests/setupAfterEnv.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'md'],
modulePathIgnorePatterns: ['/_site/'],
moduleNameMapper,
testPathIgnorePatterns: ['/node_modules/'],
transform: {
'\\.tsx?$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor',
'\\.(m?)js$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor',
'\\.md$': './node_modules/@ant-design/tools/lib/jest/demoPreprocessor',
},
testRegex: 'demo-semantic\\.test\\.(j|t)sx?$',
transformIgnorePatterns,
globals: {
'ts-jest': {
tsConfig: './tsconfig.test.json',
},
},
testEnvironmentOptions: {
url: 'http://localhost',
},
testTimeout: 10000,
};

View File

@@ -88,12 +88,10 @@
"test:dekko": "tsx ./tests/dekko/index.test.ts",
"test:image": "cross-env MOCK_USE_ID=false jest --config .jest.image.js --no-cache -i -u --forceExit",
"test:node": "npm run version && jest --config .jest.node.js --no-cache",
"test:semantic": "npm run version && jest --config .jest.semantic.js --no-cache",
"test:package-diff": "antd-tools run package-diff",
"test:site": "jest --config .jest.site.js --no-cache",
"test:site-update": "npm run site && npm run test:site -- -u",
"test:update": "jest --config .jest.js --no-cache -u",
"test:semantic:update": "npm run version && jest --config .jest.semantic.js --no-cache -u",
"test:visual-regression": "tsx scripts/visual-regression/build.ts",
"test:visual-regression:local": "tsx scripts/visual-regression/local.ts",
"token:meta": "tsx scripts/generate-token-meta.ts",