vuejs / vue-test-utils

Component Test Utils for Vue 2
https://vue-test-utils.vuejs.org
MIT License
3.57k stars 669 forks source link

ts-jest[versions] (WARN) Version 4.5.2 of typescript installed has not been tested with ts-jest. #1938

Closed leonheess closed 1 year ago

leonheess commented 2 years ago

Subject of the issue

Getting ts-jest[versions] (WARN) Version 4.5.2 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions. which makes the tests not run.

Dependencies

"dependencies": {
    "core-js": "^3.19.1",
    "vue": "^2.6.14",
    "vue-i18n": "^8.26.7",
    "vue-router": "^3.5.3",
    "vuex": "^3.6.2"
  },
  "devDependencies": {
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
    "@babel/plugin-proposal-optional-chaining": "^7.16.0",
    "@types/jest": "^27.0.3",
    "@types/systemjs": "^6.1.1",
    "@vue/cli-plugin-babel": "^4.5.15",
    "@vue/cli-plugin-typescript": "^4.5.15",
    "@vue/cli-plugin-unit-jest": "^4.5.15",
    "@vue/cli-service": "^4.5.15",
    "@vue/test-utils": "^1.3.0",
    "concurrently": "^6.4.0",
    "cypress": "^9.0.0",
    "eslint": "^7.32.0",
    "husky": "^4.3.8",
    "jest": "^27.4.3",
    "jest-junit": "^13.0.0",
    "lint-staged": "^12.1.2",
    "mock-require": "^3.0.3",
    "prettier": "^2.4.1",
    "systemjs": "^6.11.0",
    "ts-jest": "^27.0.7",
    "typescript": "^4.5.2",
    "vue-template-compiler": "^2.6.14"
  },

jest config

module.exports = {
  preset: '@vue/cli-plugin-unit-jest/presets/typescript',
  reporters: ['default', ['jest-junit', { outputName: './tests/unit/.reports/TEST-unit.xml' }]],
  transformIgnorePatterns: [],
  collectCoverage: true,
  collectCoverageFrom: ['./src/**/*.{ts,js,vue}', '!**/routes.js', '!**/shims-vue.d.ts', '!**/routerPush.ts', '!**/apis/*-api.js'],
  coverageDirectory: './tests/unit/.reports',
  coverageReporters: ['lcov', 'text', 'cobertura'],
}
leonheess commented 2 years ago

In the pipeline the error is slightly longer:

/usr/local/bin/npm run test:unit
ts-jest[versions] (WARN) Version 4.5.2 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.

PASS tests/unit/store/xxx.spec.js (11.211s)
> @mic/workflow-center@0.6.10 test:unit
PASS tests/unit/components/xxx.spec.js (7.199s)
> vue-cli-service test:unit
node:internal/process/promises:246

          triggerUncaughtException(err, true /* fromPromise */);
          ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: Unable to resolve bare specifier 'xxx' from http://localhost/ (SystemJS Error#8 https://git.io/JvFET#8)".] {
  code: 'ERR_UNHANDLED_REJECTION'
}
##[warning]Couldn't find a debug log in the cache or working directory
##[error]Error: Npm failed with return code: 1
Finishing: Run npm run test:unit
ebisbe commented 1 year ago

Did you solve it @leonheess ?