From 800739614ae88b6a5f944095aece1455d9bdf2e8 Mon Sep 17 00:00:00 2001 From: songyumeng Date: Mon, 19 Aug 2024 17:50:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=E3=80=91sonar=20ts=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=A6=86=E7=9B=96=E7=8E=87=E8=A1=8C=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jest.config.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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 };