diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d66de3553..beb38144a3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: diff --git a/.jest.js b/.jest.js index 486d7a7f6d..3a431c0f34 100644 --- a/.jest.js +++ b/.jest.js @@ -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', diff --git a/.jest.semantic.js b/.jest.semantic.js deleted file mode 100644 index e67eb2fad2..0000000000 --- a/.jest.semantic.js +++ /dev/null @@ -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, -}; diff --git a/package.json b/package.json index 76c73902ca..7b9c8c435b 100644 --- a/package.json +++ b/package.json @@ -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",