Repo with reproduction: https://github.com/nmatushevskiy/jest-with-typescript
Hello everyone, i've had a strange issue.
I'm using jest, typescript, react-native, expo, babel, and components library - native base.
I needed to override some styles of native base components, found a guide
and executed the command: node node_modules/native-base/ejectTheme.js
from guide.
Long story short. A folder "native-base-theme" has been created that contains the styles of the components and combines them in a file index.js
Because project on typescript, i renamed all created files from js to ts.
Then, in a file i overridden styles for button component as recommended in the guide and tried to test it.
file with test: file
After npm run test, executable test freezes. As shown in the picture:
console screenshot
I tried to mock methods from native-base-theme/components. It doesn't help.
Also tried to debug it with debugger (in index.test.ts shows where the debuggers were placed), but none of the debuggers been called.
Then i tried to solve problem by babel.config and jest.config, using suggested solutions of similar problems. It doesn't help too.
However, when i revert native-base-theme files from ts to js, test successfully completing.
googling doesn't help.
Also, tests works with some simple exported typescript functions.
For example:
some-file.ts
export function sum(a: number, b: number): number {
return a + b;
}
Please, can anyone explain the reasoning of this behavior and how to fix it.
Thank you in advance.