Note that VSCode is able to find the interface in the screenshot below, which tells me that from a TypeScript perspective, my configuration should be ok, because otherwise VSCode shows me lots of type errors if I have those configurations wrong.
# content of ts-jest.log :
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"26.5.3"},"message":"creating jest presets not handling JavaScript files","sequence":1,"time":"2021-03-11T16:29:22.994Z"}
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"26.5.3"},"message":"creating jest presets not handling JavaScript files","sequence":2,"time":"2021-03-11T16:29:23.024Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"26.5.3"},"message":"creating Importer singleton","sequence":3,"time":"2021-03-11T16:29:23.573Z"}
{"context":{"actualVersion":"26.6.3","expectedVersion":">=26 <27","logLevel":20,"namespace":"versions","package":"ts-jest","version":"26.5.3"},"message":"checking version of jest: OK","sequence":4,"time":"2021-03-11T16:29:23.578Z"}
{"context":{"logLevel":20,"namespace":"ts-jest-transformer","package":"ts-jest","version":"26.5.3"},"message":"created new transformer","sequence":5,"time":"2021-03-11T16:29:23.578Z"}
{"context":{"logLevel":30,"namespace":"ts-jest-transformer","package":"ts-jest","version":"26.5.3"},"message":"no matching config-set found, creating a new one","sequence":6,"time":"2021-03-11T16:29:23.579Z"}
{"context":{"config":{"automock":false,"cache":true,"cacheDirectory":"/tmp/jest_rt","clearMocks":false,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/home/sam/gatsby-source-shopify-graphql-poc/plugin","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{"computeSha1":false,"throwOnModuleCollision":false},"injectGlobals":true,"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"name":"7650e90a1ff57f0cbbb2a111f8134593","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/home/sam/gatsby-source-shopify-graphql-poc/plugin","roots":["/home/sam/gatsby-source-shopify-graphql-poc/plugin"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"slowTestThreshold":5,"snapshotSerializers":[],"testEnvironment":"/home/sam/gatsby-source-shopify-graphql-poc/plugin/node_modules/jest-environment-node/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__tests__/**/*.[jt]s?(x)","**/?(*.)+(spec|test).[tj]s?(x)"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/home/sam/gatsby-source-shopify-graphql-poc/plugin/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/home/sam/gatsby-source-shopify-graphql-poc/plugin/node_modules/ts-jest/dist/index.js",{}]],"transformIgnorePatterns":["/node_modules/","\\.pnp\\.[^\\/]+$"],"watchPathIgnorePatterns":[]},"logLevel":20,"namespace":"backports","package":"ts-jest","version":"26.5.3"},"message":"backporting config","sequence":7,"time":"2021-03-11T16:29:23.579Z"}
{"context":{"jestConfig":{"automock":false,"cache":true,"cacheDirectory":"/tmp/jest_rt","clearMocks":false,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/home/sam/gatsby-source-shopify-graphql-poc/plugin","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extraGlobals":[],"forceCoverageMatch":[],"globals":{"ts-jest":{}},"haste":{"computeSha1":false,"throwOnModuleCollision":false},"injectGlobals":true,"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"name":"7650e90a1ff57f0cbbb2a111f8134593","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/home/sam/gatsby-source-shopify-graphql-poc/plugin","roots":["/home/sam/gatsby-source-shopify-graphql-poc/plugin"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"slowTestThreshold":5,"snapshotSerializers":[],"testEnvironment":"/home/sam/gatsby-source-shopify-graphql-poc/plugin/node_modules/jest-environment-node/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__tests__/**/*.[jt]s?(x)","**/?(*.)+(spec|test).[tj]s?(x)"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/home/sam/gatsby-source-shopify-graphql-poc/plugin/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/home/sam/gatsby-source-shopify-graphql-poc/plugin/node_modules/ts-jest/dist/index.js",{}]],"transformIgnorePatterns":["/node_modules/","\\.pnp\\.[^\\/]+$"],"watchPathIgnorePatterns":[]},"logLevel":20,"namespace":"config","package":"ts-jest","version":"26.5.3"},"message":"normalized jest config","sequence":8,"time":"2021-03-11T16:29:23.580Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","requireResult":{"exists":true,"given":"typescript","path":"/home/sam/gatsby-source-shopify-graphql-poc/plugin/node_modules/typescript/lib/typescript.js"},"version":"26.5.3"},"message":"loaded module typescript","sequence":9,"time":"2021-03-11T16:29:23.580Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"26.5.3"},"message":"patching typescript","sequence":10,"time":"2021-03-11T16:29:23.580Z"}
{"context":{"actualVersion":"4.2.3","expectedVersion":">=3.8 <5","logLevel":20,"namespace":"versions","package":"ts-jest","version":"26.5.3"},"message":"checking version of typescript: OK","sequence":11,"time":"2021-03-11T16:29:23.580Z"}
🐛 Bug Report
Interfaces defined in my project's
.d.tsfile are not picked up byts-jest.My project uses types defined in
plugin/types/interface.d.ts. The source code inplugin/srcreferences these types and compiles without issue. But if these types are referenced within the context ofts-jest, the test suite fails to run with Cannot find name errors.To Reproduce
The complete test setup can be seen in this draft PR
Steps to reproduce the behavior:
yarnplugin/directoryyarn testExpected behavior
The tests should pass, but instead:
Note that VSCode is able to find the interface in the screenshot below, which tells me that from a TypeScript perspective, my configuration should be ok, because otherwise VSCode shows me lots of type errors if I have those configurations wrong.
Link to repo (highly encouraged)
https://github.com/gatsbyjs/gatsby-source-shopify-experimental/pull/73/files
Debug log:
envinfo