diff --git a/jest.config.js b/jest.config.js index 0f07a605..f7df472e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,6 +3,7 @@ const babelConfig = require('./babel.config')(); process.env.VUE_CLI_BABEL_TARGET_NODE = true; process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = true; +// babelConfig.inputSourceMap = false; module.exports = { rootDir: path.resolve(__dirname), @@ -20,18 +21,12 @@ module.exports = { '@i18n/(.*)$': '/src/common/$1', '@leaflet/(.*)$': '/src/leaflet/$1', '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': - '/test/unit/assetsTransformer.js', + '/test/unit/assetsTransformer.js', '^axios$': require.resolve('axios') }, transform: { - '^.+\\.ts$': [ - '/node_modules/babel-jest', - { extends: './babel.config.js', presets: ['@babel/preset-typescript'] } - ], - '^.+\\.js$': [ - '/node_modules/babel-jest', - { extends: './babel.config.js', presets: ['@babel/preset-typescript'] } - ], + '^.+\\.ts$': '/node_modules/ts-jest', + '^.+\\.js$': '/node_modules/babel-jest', '.*\\.(vue)$': '/node_modules/vue-jest', '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': '/node_modules/jest-transform-stub' }, @@ -51,8 +46,13 @@ module.exports = { 'node_modules/(?!(mapbox-gl|axios|element-ui|ant-design-vue|geographic-coordinate-converter|videojs-flvjs-es6|vue-videojs7|three)/)' ], modulePaths: ['src', 'node_modules'], - reporters: ['default', 'jest-teamcity'], - globals: {}, + reporters: ["default", "jest-teamcity"], + globals: { + 'ts-jest': { + tsConfig: '/tsconfig.json', + babelConfig: babelConfig + } + }, cache: false };