tests are not run properly
Closed this issue ยท 2 comments
Hotell commented
When this runner is used tests are not executed as they should ๐
configs:
with transform: ts-jest
const { defaults } = require('jest-config')
const config = {
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest'
},
testMatch: [
...defaults.testMatch,
'**/__tests__/**/*.ts?(x)',
'**/?(*.)+(spec|test).ts?(x)'
],
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
globals: {
'ts-jest': {
skipBabel: true
}
}
}
module.exports = config
with runner: 'jest-runner-tsc'
:
const { defaults } = require('jest-config')
const config = {
runner: 'jest-runner-tsc',
testMatch: [
...defaults.testMatch,
'**/__tests__/**/*.ts?(x)',
'**/?(*.)+(spec|test).ts?(x)'
],
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx']
}
module.exports = config
test suite run with ts-jest as transform vs just jest-runner-tsc as runner:
azz commented
They are different things :) ts-jest is to transform TS code into JS. jest-runner-tsc doesn't run tests, it runs the TS typechecker, so it's like a linter. You need to run both.