chore: ts-jest

pull/2933/head
Amour1688 4 years ago
parent 150ebf15a5
commit 81e15834c2

@ -13,12 +13,13 @@ if (process.env.WORKFLOW === 'true') {
module.exports = { module.exports = {
testURL: 'http://localhost/', testURL: 'http://localhost/',
setupFiles: ['./tests/setup.js'], setupFiles: ['./tests/setup.js'],
moduleFileExtensions: ['js', 'jsx', 'json', 'vue', 'md', 'jpg'], moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'vue', 'md', 'jpg'],
modulePathIgnorePatterns: ['/_site/'], modulePathIgnorePatterns: ['/_site/'],
testPathIgnorePatterns: testPathIgnorePatterns, testPathIgnorePatterns: testPathIgnorePatterns,
transform: { transform: {
'^.+\\.(vue|md)$': '<rootDir>/node_modules/vue-jest', '^.+\\.(vue|md)$': '<rootDir>/node_modules/vue-jest',
'^.+\\.(js|jsx)$': '<rootDir>/node_modules/babel-jest', '^.+\\.(js|jsx)$': '<rootDir>/node_modules/babel-jest',
'^.+\\.(ts|tsx)$': '<rootDir>/node_modules/ts-jest',
'^.+\\.svg$': '<rootDir>/node_modules/jest-transform-stub', '^.+\\.svg$': '<rootDir>/node_modules/jest-transform-stub',
}, },
testRegex: libDir === 'dist' ? 'demo\\.test\\.js$' : '.*\\.test\\.js$', testRegex: libDir === 'dist' ? 'demo\\.test\\.js$' : '.*\\.test\\.js$',
@ -45,4 +46,9 @@ module.exports = {
], ],
testEnvironment: 'jest-environment-jsdom-fifteen', testEnvironment: 'jest-environment-jsdom-fifteen',
transformIgnorePatterns, transformIgnorePatterns,
globals: {
'ts-jest': {
babelConfig: true,
},
},
}; };

@ -130,7 +130,7 @@
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"husky": "^4.0.0", "husky": "^4.0.0",
"istanbul-instrumenter-loader": "^3.0.0", "istanbul-instrumenter-loader": "^3.0.0",
"jest": "^25.4.0", "jest": "^26.0.0",
"jest-environment-jsdom-fifteen": "^1.0.2", "jest-environment-jsdom-fifteen": "^1.0.2",
"jest-serializer-vue": "^2.0.0", "jest-serializer-vue": "^2.0.0",
"jest-transform-stub": "^2.0.0", "jest-transform-stub": "^2.0.0",
@ -168,6 +168,7 @@
"stylelint-config-standard": "^19.0.0", "stylelint-config-standard": "^19.0.0",
"terser-webpack-plugin": "^3.0.3", "terser-webpack-plugin": "^3.0.3",
"through2": "^3.0.0", "through2": "^3.0.0",
"ts-jest": "^26.4.1",
"ts-loader": "^8.0.2", "ts-loader": "^8.0.2",
"typescript": "^4.0.2", "typescript": "^4.0.2",
"umi-mock-middleware": "^1.0.0", "umi-mock-middleware": "^1.0.0",

Loading…
Cancel
Save