forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "chore: migrate to vitest (ant-design#42506)" (ant-design#42900)
This reverts commit 6759887.
- Loading branch information
Showing
444 changed files
with
3,579 additions
and
3,491 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ coverage | |
**/*.d.ts | ||
# Scripts | ||
scripts/previewEditor/**/* | ||
jest-stare |
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
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,23 @@ | ||
const { moduleNameMapper, transformIgnorePatterns } = require('./.jest'); | ||
|
||
// jest config for image snapshots | ||
module.exports = { | ||
setupFiles: ['./tests/setup.js'], | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'md'], | ||
moduleNameMapper, | ||
transform: { | ||
'\\.tsx?$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', | ||
'\\.js$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', | ||
'\\.md$': './node_modules/@ant-design/tools/lib/jest/demoPreprocessor', | ||
'\\.(jpg|png|gif|svg)$': './node_modules/@ant-design/tools/lib/jest/imagePreprocessor', | ||
}, | ||
testRegex: 'image\\.test\\.(j|t)s$', | ||
transformIgnorePatterns, | ||
globals: { | ||
'ts-jest': { | ||
tsConfigFile: './tsconfig.test.json', | ||
}, | ||
}, | ||
preset: 'jest-puppeteer', | ||
testTimeout: 10000, | ||
}; |
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,68 @@ | ||
const compileModules = ['react-sticky-box', 'rc-tween-one', '@babel', '@ant-design', 'countup.js']; | ||
|
||
const ignoreList = []; | ||
|
||
// cnpm use `_` as prefix | ||
['', '_'].forEach((prefix) => { | ||
compileModules.forEach((module) => { | ||
ignoreList.push(`${prefix}${module}`); | ||
}); | ||
}); | ||
|
||
const transformIgnorePatterns = [ | ||
// Ignore modules without es dir. | ||
// Update: @babel/runtime should also be transformed | ||
`/node_modules/(?!${ignoreList.join('|')})[^/]+?/(?!(es)/)`, | ||
]; | ||
|
||
function getTestRegex(libDir) { | ||
if (['dist', 'lib', 'es'].includes(libDir)) { | ||
return 'demo\\.test\\.(j|t)sx?$'; | ||
} | ||
return '.*\\.test\\.(j|t)sx?$'; | ||
} | ||
|
||
module.exports = { | ||
verbose: true, | ||
testEnvironment: 'jsdom', | ||
setupFiles: ['./tests/setup.js', 'jest-canvas-mock'], | ||
setupFilesAfterEnv: ['./tests/setupAfterEnv.ts'], | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'md'], | ||
modulePathIgnorePatterns: ['/_site/'], | ||
moduleNameMapper: { | ||
'/\\.(css|less)$/': 'identity-obj-proxy', | ||
'^antd$': '<rootDir>/components/index', | ||
'^antd/es/(.*)$': '<rootDir>/components/$1', | ||
}, | ||
testPathIgnorePatterns: ['/node_modules/', 'dekko', 'node', 'image.test.js', 'image.test.ts'], | ||
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', | ||
'\\.(jpg|png|gif|svg)$': './node_modules/@ant-design/tools/lib/jest/imagePreprocessor', | ||
}, | ||
testRegex: getTestRegex(process.env.LIB_DIR), | ||
collectCoverageFrom: [ | ||
'components/**/*.{ts,tsx}', | ||
'!components/*/style/index.tsx', | ||
'!components/style/index.tsx', | ||
'!components/*/locale/index.tsx', | ||
'!components/*/__tests__/type.test.tsx', | ||
'!components/**/*/interface.{ts,tsx}', | ||
'!components/*/__tests__/image.test.{ts,tsx}', | ||
'!components/__tests__/node.test.tsx', | ||
'!components/*/demo/*.tsx', | ||
'!components/*/design/**', | ||
], | ||
transformIgnorePatterns, | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: './tsconfig.test.json', | ||
}, | ||
}, | ||
testEnvironmentOptions: { | ||
url: 'http://localhost', | ||
}, | ||
// bail: true, | ||
maxWorkers: '50%', | ||
}; |
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,19 @@ | ||
const { moduleNameMapper, transformIgnorePatterns } = require('./.jest'); | ||
|
||
// jest config for server render environment | ||
module.exports = { | ||
setupFiles: ['./tests/setup.js'], | ||
setupFilesAfterEnv: ['./tests/setupAfterEnv.ts'], | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'md'], | ||
moduleNameMapper, | ||
transform: { | ||
'\\.tsx?$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', | ||
'\\.js$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', | ||
'\\.md$': './node_modules/@ant-design/tools/lib/jest/demoPreprocessor', | ||
'\\.(jpg|png|gif|svg)$': './node_modules/@ant-design/tools/lib/jest/imagePreprocessor', | ||
}, | ||
testRegex: 'node\\.test\\.(j|t)sx$', | ||
testEnvironment: 'node', | ||
transformIgnorePatterns, | ||
// bail: true, | ||
}; |
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,21 @@ | ||
const { moduleNameMapper, transformIgnorePatterns } = require('./.jest'); | ||
|
||
// jest config for server render environment | ||
module.exports = { | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'md'], | ||
moduleNameMapper, | ||
transform: { | ||
'\\.tsx?$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', | ||
'\\.js$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', | ||
'\\.md$': './node_modules/@ant-design/tools/lib/jest/demoPreprocessor', | ||
'\\.(jpg|png|gif|svg)$': './node_modules/@ant-design/tools/lib/jest/imagePreprocessor', | ||
}, | ||
testRegex: 'check-site\\.(j|t)s$', | ||
testEnvironment: 'node', | ||
transformIgnorePatterns, | ||
globals: { | ||
'ts-jest': { | ||
tsConfigFile: './tsconfig.test.json', | ||
}, | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
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
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.