Closed MichalLytek closed 4 years ago
Hey @MichalLytek :)
I'm hitting a similar-seeming issue. In my project I do not have this error in VSCode, just from ts-jest.
But It might not be related as I downgraded to 3.6 and still have this error. My case doesn't seem to be tied to 3.7.
I think we can close the issue now - ts-jest
v24.2.0 works for me with TS v3.7.3 😉
Thanks, this is strange. Perhaps that is the error of ts < 3.7.3 ?
@MichalLytek Can you try removing your lock file and run yarn install again. Jest released a minor upgrade from 24.8.0 to 24.9.0 which breaks ts-jest for me. What about you?
@ChrisLahaye I've removed the lock, bootstraped the monorepo, everything works ok 💪
"ts-jest": "^24.2.0",
"typescript": "~3.7.3",
"jest": "^24.9.0",
Hi, I have always the problem:
Here, my tsconfig:
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"lib": [
"esnext",
"esnext.asynciterable",
"dom"
],
"resolveJsonModule": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"allowJs": true,
"sourceMap": true,
"strict": true,
"noImplicitAny": false,
"noEmit": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./*"
],
"@/*": [
"./*"
]
},
"types": [
"@types/node",
"@types/jest",
"@nuxt/types",
"@nuxtjs/vuetify"
]
},
"include": ["**/*.ts", "**/*.vue"],
"exclude": [
"node_modules",
]
// "files": ["ts-shim.d.ts"]
}
jest.config:
const config = {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'^~/(.*)$': '<rootDir>/$1',
'^vue$': 'vue/dist/vue.common.js'
},
// preset: 'ts-jest',
// testEnvironment: 'node',
// modulePathIgnorePatterns: ['<rootDir>/cypress/'],
moduleFileExtensions: ['js', 'json', 'ts', 'vue'],
transform: { // The order is important. Vue must comme first.
// '^.+\\.js$': 'babel-jest',
// process TypeScript files
'^.+\\.ts$': 'ts-jest',
// process *.vue files with vue-jest
'.*\\.(vue)$': 'vue-jest'
},
// verbose: true,
testMatch: [
'**/test/**/*.spec.+(ts|tsx|js)'
],
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/components/example/',
'<rootDir>/cypress/'
],
transformIgnorePatterns: ['<rootDir>/node_modules/'],
// serializer for snapshots
snapshotSerializers: [
'jest-serializer-vue'
]
}
module.export = config
Package.json:
"devDependencies": {
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"@babel/preset-typescript": "^7.8.3",
"@mdi/font": "^4.7.95",
"@nuxt/typescript-build": "^0.5.5",
"@nuxt/typescript-runtime": "^0.3.6",
"@nuxtjs/auth": "^4.8.5",
"@nuxtjs/axios": "^5.9.2",
"@nuxtjs/eslint-config-typescript": "^1.0.0",
"@nuxtjs/proxy": "^1.3.3",
"@nuxtjs/pwa": "^3.0.0-beta.19",
"@nuxtjs/vuetify": "^1.9.1",
"@types/jest": "^24.0.25",
"@types/lodash.overargs": "^4.7.6",
"@vue/test-utils": "^1.0.0-beta.30",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^24.9.0",
"cross-env": "^6.0.3",
"cypress": "^3.8.1",
"cypress-jest-adapter": "^0.1.1",
"eslint": "^6.8.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-cypress": "^2.8.1",
"eslint-plugin-jest": "^23.3.0",
"eslint-plugin-json": "^2.0.1",
"eslint-plugin-nuxt": "^0.5.0",
"eslint-plugin-vue": "^6.1.2",
"eslint-plugin-vuetify": "^1.0.0-beta.5",
"intro.js": "^2.9.3",
"jest": "^24.9.0",
"jest-serializer-vue": "^2.0.2",
"loadash": "^1.0.0",
"npm-check-updates": "^4.0.1",
"nuxt": "^2.11.0",
"nuxt-env": "^0.1.0",
"nuxt-property-decorator": "^2.5.0",
"sass": "^1.24.1",
"sass-loader": "^8.0.0",
"ts-jest": "^24.3.0",
"ts-node": "^8.5.4",
"typedoc": "^0.15.6",
"vue-eslint-parser": "^7.0.0",
"vue-grid-layout": "^2.3.7",
"vue-i18n": "^8.15.3",
"vue-jest": "^3.0.5",
"vue-json-component": "^0.3.0",
"vue-meta": "^2.3.1",
"vue-property-decorator": "^8.3.0",
"vuedraggable": "^2.23.2",
"vuetify": "2.1.15",
"vuetify-toast-snackbar": "^0.6.1",
"vuex-class": "^0.3.2",
"vuex-persistedstate": "^2.7.0"
}
please do these following steps:
tsconfig.spec.json
which extends tsconfig.json
ts-jest
config to use that tsconfig.spec.json
module: commonjs
and target: es2020
(don't use target: esnext
) to this tsconfig.spec.json
.
Issue :
When I've updated my deps, the tests stopped working. I have a custom monorepo setup with TS references, Jest projects and
ttypescript
compiler to rewrite@paths
on compile.When I've downgraded the TS deps to 3.6.3, it works as earlier:
I've created two branches that you can checkout and reproduce: https://github.com/MichalLytek/type-graphql/tree/ts-jest-3.7.2 https://github.com/MichalLytek/type-graphql/tree/ts-jest-3.6.3
Expected behavior :
It should work as before upgrade.
Minimal repo :
https://github.com/MichalLytek/type-graphql/tree/ts-jest-3.7.2 https://github.com/MichalLytek/type-graphql/tree/ts-jest-3.6.3