We are using cross-platform implementations for our react as well as react-native components. In general we have the following structure:
src├── component1│├── index.tsx│└── index.spec.tsx├── component2│├── index.tsx│├── index.native.tsx│├── index.native.spec.tsx│├── index.web.spec.tsx
We run two different test suites for native and web. On web coverage is collected from all typescript files that do not contain .native extension. But how can I configure jest to exclude index.tsx
files from native coverage whenever an index.native.tsx
file exists?
Do I have to manually exclude each of these files by using the coveragePathIgnorePatterns
option or is there a way to do this with testMatch
?
Thanks in advance!