I am using detox as the end-2-end tester for my react-native app but I don't want whats in the e2e folder to be included when I run npm test. I am currently using jest for the npm test.
This is what i have in my package.json:
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!(react-native|static-container|expo|@expo|react-navigation))"
]
},
The e2e folder is located in my root directory and my test files are in my tests folder in the root directory also.
To get around this problem when I run my jest tests I use the testMatch property and set it in the package.json
this means that it will only match the tests that are in the folders that I have specified.
"jest": {
"preset": "react-native",
"testMatch": [
"<rootDir>/__tests__/**/*.test.js?(x)",
"<rootDir>/app/**/*.test.js"
]
},
Alternatively you can use to ignore specific paths.
"jest": {
"preset": "react-native",
"testPathIgnorePatterns": [
"<rootDir>/e2e"
]
},