Ignoring __test__ folder during the build process

Hey guys I am trying to ignore my test files during the build process but unable to progress, can someone please help me out, here's my tsconfig file
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": ".",
"rootDir": ".",
"isolatedModules": true,
"jsx": "preserve"
},
"paths": {
"~/*": ["<rootDir>"]
},
"include": [
"next-env.d.ts",
"**/*.js",
"**/*.ts",
"**/*.tsx",
"./.eslintrc.cjs"
],
"exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx"]
}
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": ".",
"rootDir": ".",
"isolatedModules": true,
"jsx": "preserve"
},
"paths": {
"~/*": ["<rootDir>"]
},
"include": [
"next-env.d.ts",
"**/*.js",
"**/*.ts",
"**/*.tsx",
"./.eslintrc.cjs"
],
"exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx"]
}
2 Replies
JulieCezar
JulieCezar15mo ago
try to ignore folder?
"exclude": ["node_modules", "__test__"]
"exclude": ["node_modules", "__test__"]
How do your test files look like?
__izilla__
__izilla__15mo ago
I am assuming that they are co-located so something like src/components/MyComponent/MyComponent.tsx and src/components/MyComponent.test.tsx @juliecezar answer assumes that tests file live somewhere like __test__/components/MyComponent/MyComponent.test.tsx if they are co-located and you don't have other tsx files you can remove the "**/*.tsx" and from the include as that will include the *.test.tsx files but explicitly excluding them should work as long as there are not any other tsx files in your source tree that you do not want
Want results from more Discord servers?
Add your server