Commit ba87845a authored by Sendya's avatar Sendya

fix: jest test script

parent 9f260651
...@@ -5,17 +5,18 @@ module.exports = { ...@@ -5,17 +5,18 @@ module.exports = {
testURL: 'http://localhost/', testURL: 'http://localhost/',
preset: 'ts-jest', preset: 'ts-jest',
moduleFileExtensions: ['js', 'ts', 'tsx', 'json', 'vue'], moduleFileExtensions: ['js', 'ts', 'tsx', 'json', 'vue'],
modulePathIgnorePatterns: ['/_site/'], modulePathIgnorePatterns: ['/_site/', '/examples/'],
transform: { transform: {
// '^.+\\.(js|jsx|ts|tsx)$': '<rootDir>/jest/jestpreprocessor.js',
'^.+\\.js$': 'babel-jest', '^.+\\.js$': 'babel-jest',
'^.+\\.(ts|tsx)$': 'ts-jest', '^.+\\.(ts|tsx)$': 'ts-jest',
// '^.+\\.svg$': '<rootDir>/node_modules/jest-transform-stub',
'^.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', '^.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
}, },
testRegex: libDir === 'dist' ? 'demo\\.test\\.ts$' : '.*\\.test\\.tsx$', testRegex: libDir === 'dist' ? 'demo\\.test\\.ts$' : '.*\\.test\\.tsx$',
testEnvironment: 'jest-environment-jsdom-fifteen', testEnvironment: 'jest-environment-jsdom-fifteen',
moduleNameMapper: { moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1', '^@/(.*)$': '<rootDir>/$1',
// '^.*ant-design/icons.*\\.js': '<rootDir>/node_modules/babel-jest',
// '^.*lodash-es.*\\.js': '<rootDir>/node_modules/babel-jest', // '^.*lodash-es.*\\.js': '<rootDir>/node_modules/babel-jest',
// '^.*ant-design-vue.*[.]?style|css|less.*$': 'jest-transform-stub', // '^.*ant-design-vue.*[.]?style|css|less.*$': 'jest-transform-stub',
}, },
...@@ -27,7 +28,7 @@ module.exports = { ...@@ -27,7 +28,7 @@ module.exports = {
'/dist/', '/dist/',
// Ignore modules without es dir. // Ignore modules without es dir.
// Update: @babel/runtime should also be transformed // Update: @babel/runtime should also be transformed
'<rootDir>/node_modules/(?!(lodash-es|ant-design-vue/es))', '<rootDir>/node_modules/(?!(lodash-es|ant-design-vue/es|@ant-design/icons-vue|@ant-design/icons-svg))',
], ],
verbose: true, verbose: true,
globals: { globals: {
......
...@@ -13,6 +13,7 @@ module.exports = { ...@@ -13,6 +13,7 @@ module.exports = {
'@babel/plugin-syntax-dynamic-import', '@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-runtime', '@babel/plugin-transform-runtime',
'@babel/plugin-transform-modules-commonjs', '@babel/plugin-transform-modules-commonjs',
// 'transform-es2015-modules-commonjs',
], ],
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment