Browse Source

chore: ts-jest

pull/2933/head
Amour1688 4 years ago
parent
commit
81e15834c2
  1. 8
      .jest.js
  2. 0
      components/index.js
  3. 3
      package.json

8
.jest.js

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

0
components/index.ts → components/index.js

3
package.json

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

Loading…
Cancel
Save