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.
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.
Share Improve this question edited Feb 28, 2019 at 14:31 skyboyer 23.8k7 gold badges62 silver badges71 bronze badges asked Feb 28, 2019 at 14:14 Liam RamsbottomLiam Ramsbottom 1874 silver badges15 bronze badges1 Answer
Reset to default 7To 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"
]
},