I am appending some common functions to the global
object in my setupTests.ts
so I don't need to import them in every test file. The tests are passing, but TypeScript autocompletion is not working and VSCode shows "Cannot find name ...
". How can I fix it?
package.json
"jest": {"preset": "jest-expo","roots": ["<rootDir>/src" ],"setupFiles": ["<rootDir>/src/config/setupTests.ts" ]}
setupTests.ts
import React from 'react';import { render } from 'react-native-testing-library';global.React = React;(global as any).render = render;
some.test.tsx
const wrapper = render(<Text>Some test</Text>);