I'm testing my React application built with Typescript and Relay. When I try to test relay powered component I am getting following errors:
Unexpected invocation at runtime. Either the Babel transform was not set up, or it failed to identify this call site. Make sure it is being used verbatim as `graphql`.
I've following .babelrc file:
{
"presets": ["@babel/env", "@babel/react"],
"plugins": ["relay",
[
"transform-relay-hot",
{
"schema": "./schema.graphql",
"watchInterval": 2000,
"verbose": true
}
]
]
}
and following Jest configurations:
module.exports = {
roots: ["<rootDir>/src"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testRegex : "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
moduleFileExtensions : ["ts", "tsx", "js", "jsx", "json", "node"],
transformIgnorePatterns : ["node_modules/(?!(date-fns))"],
moduleNameMapper: {
"^Apps(.*)$" : "<rootDir>/src/apps$1",
"^Pages(.*)$" : "<rootDir>/src/pages$1",
"^Components(.*)$": "<rootDir>/src/components$1",
"^Logic(.*)$" : "<rootDir>/src/logic$1",
"^Theme(.*)$" : "<rootDir>/src/theme$1",
"^Config(.*)$" : "<rootDir>/src/config$1",
"^Public(.*)$" : "<rootDir>/src/public$1",
},
globals: {
'ts-jest': {
tsConfig: "tsconfig.json",
// diagnostics: false
}
},
setupTestFrameworkScriptFile: "./src/test/test.setup.ts"
};
Am I missing something here?