Version
v29.x
Steps to reproduce
Baseline, v28
- Clone repo:
git clone git@github.com:apollo-server-integrations/apollo-server-integration-aws-lambda.git
- Install and run tests:
npm i && npm t
- Note no failures
Errors after upgrading to v29
- Checkout reproduction branch:
git checkout trevor/jest-v29
- Install and run tests:
npm i && npm t
- Note the following failures:
Expand for error output
-
ts-jest[ts-jest-transformer] (WARN) Define ts-jest config under globals is deprecated. Please do
transform: {
<transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],
},
-
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting esModuleInterop to true in your TypeScript configuration file (usually tsconfig.json). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
-
src/index.ts:78:21 - error TS2550: Property 'fromEntries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later.
78 ...Object.fromEntries(headers),
~~~~~~~~~~~
Expected behavior
I expect ts-jest to resolve and use the tsconfig that is specified in my Jest config.
Actual behavior
ts-jest does not resolve my specified tsconfig, but instead resolves the default tsconfig.json at the root of the project.
Debug log
Available on request (or can be generated through the reproduction). It is too long to submit the issue.
Additional context
Problem
The errors are a bit cryptic, but I've deduced that ts-jest is no longer resolving the specified tsconfig file in the jest config (below). It is instead always falling back to the default tsconfig.json.
I've also tried updating to the transform configuration format with the same result.
Confirmation steps
- Rename the top level tsconfig:
mv tsconfig.json _tsconfig.json
- Rename the test-specific tsconfig:
mv tsconfig.test.json tsconfig.json
- Run the tests:
npm t
- Note no errors
Jest config
import type { Config } from '@jest/types';
const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['src'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.test.json',
},
},
testRegex: '/__tests__/.*.test.ts$',
verbose: true,
snapshotFormat: { escapeString: false, printBasicPrototype: false },
};
export default config;
Environment
System:
OS: macOS 12.3.1
CPU: (8) arm64 Apple M1
Binaries:
Node: 16.17.0 - ~/Desktop/ApolloRepos/apollo-server-integration-aws-lambda/.volta/tools/image/node/16.17.0/bin/node
npm: 8.18.0 - ~/Desktop/ApolloRepos/apollo-server-integration-aws-lambda/.volta/tools/image/npm/8.18.0/bin/npm
npmPackages:
jest: 29.0.0 => 29.0.0
Version
v29.x
Steps to reproduce
Baseline, v28
git clone git@github.com:apollo-server-integrations/apollo-server-integration-aws-lambda.gitnpm i && npm tErrors after upgrading to v29
git checkout trevor/jest-v29npm i && npm tExpand for error output
ts-jest[ts-jest-transformer] (WARN) Define
ts-jestconfig underglobalsis deprecated. Please dotransform: {
<transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],
},
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting
esModuleInteroptotruein your TypeScript configuration file (usuallytsconfig.json). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.src/index.ts:78:21 - error TS2550: Property 'fromEntries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later.
78 ...Object.fromEntries(headers),
~~~~~~~~~~~
Expected behavior
I expect
ts-jestto resolve and use thetsconfigthat is specified in my Jest config.Actual behavior
ts-jestdoes not resolve my specifiedtsconfig, but instead resolves the defaulttsconfig.jsonat the root of the project.Debug log
Available on request (or can be generated through the reproduction). It is too long to submit the issue.
Additional context
Problem
The errors are a bit cryptic, but I've deduced that
ts-jestis no longer resolving the specifiedtsconfigfile in the jest config (below). It is instead always falling back to the defaulttsconfig.json.I've also tried updating to the
transformconfiguration format with the same result.Confirmation steps
mv tsconfig.json _tsconfig.jsonmv tsconfig.test.json tsconfig.jsonnpm tJest config
Environment
System: OS: macOS 12.3.1 CPU: (8) arm64 Apple M1 Binaries: Node: 16.17.0 - ~/Desktop/ApolloRepos/apollo-server-integration-aws-lambda/.volta/tools/image/node/16.17.0/bin/node npm: 8.18.0 - ~/Desktop/ApolloRepos/apollo-server-integration-aws-lambda/.volta/tools/image/npm/8.18.0/bin/npm npmPackages: jest: 29.0.0 => 29.0.0