Получаю ошибку во время компиляции jest теста
Когда пытаюсь запустить тест для vue2 получаю ошибку распознавания функции, на гитхабе есть похожий вопрос https://github.com/exercism/exercism/issues/4412, но там проблема с импортами, у меня же с ними всё впорядке
Error log:
TypeError: (0 , helpers_1.getEnv) is not a function
2 | import { getEnv } from '@/helpers';
3 |
> 4 | const apiUrl = getEnv('VUE_APP_GW_SERVER_URL') || '';
| ^
5 |
6 | export const gatewayApi = axios.create({
7 | baseURL: getEnv('NODE_ENV') === 'development' ? apiUrl : getEnv('VUE_APP_API_SERVER_URL'),
package:
{
"name": "tests",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "0.24.0",
"core-js": "^3.8.3",
"date-fns": "2.26.0",
"imask": "6.2.2",
"lodash": "4.17.21",
"material-design-icons-iconfont": "6.1.1",
"portal-vue": "2.1.7",
"qs": "6.10.1",
"sb": "6.3.12",
"v-mask": "^2.3.0",
"vue": "^2.6.14",
"vue-meta": "2.4.0",
"vue-router": "^3.5.1",
"vue-yandex-maps": "0.10.12",
"vue-yandex-metrika": "1.8.3",
"vuetify": "2.6.0",
"vuex": "^3.6.2",
"vuex-persistedstate": "4.1.0"
},
"devDependencies": {
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-plugin-unit-jest": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/eslint-config-typescript": "^9.1.0",
"@vue/test-utils": "^1.1.3",
"@vue/vue2-jest": "^27.0.0-alpha.2",
"babel-jest": "^27.0.6",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"jest": "^27.0.5",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"ts-jest": "^27.0.4",
"ts-node": "^10.9.1",
"typescript": "~4.5.5",
"vue-template-compiler": "^2.6.14"
}
}
babel conf:
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
jest conf:
enum NS {
app = 'app',
auth = 'auth',
registration = 'registration',
user = 'user',
locality = 'locality',
terminal = 'terminal',
customer = 'customer',
partner = 'partner',
serviceType = 'serviceType',
order = 'order',
timezone = 'timezone',
userDocumentType = 'userDocumentType',
notification = 'notification',
tracking = 'tracking',
orderCreate = 'orderCreate',
deliveryType = 'deliveryType',
}
module.exports = {
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel',
globals: {
NS,
},
}
ts conf:
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"noImplicitAny": false,
"importHelpers": true,
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"jest",
"vuetify"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}
Thanks