I'm trying to upgrade jest from v27 to v28. In my test files when I try to access GLOBAL_VARIABLE that is specified in jest-preset file I have this error
ReferenceError: GLOBAL_VARIABLE is not defined
package.json
"jest": "~28.0.0",
"ts-jest": "~28.0.0-next.3"
my jest-preset file looks like this
module.exports = {
verbose: true,
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest/legacy',
testEnvironment: 'node',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/scripts/jest/tsconfig.json',
isolatedModules: true,
},
GLOBAL_VARIABLE: true
},
},
When running this with jest v27 it works as expected