Skip to content

Commit

Permalink
fix: ignore test files and folders
Browse files Browse the repository at this point in the history
  • Loading branch information
hosseinmd committed Jan 18, 2022
1 parent 32cc99e commit 85698c9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/tests/src/persianChars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,30 @@ import path from "path";
function readRoot(resolver: (...dirs: string[]) => string) {
return fs.readdirSync(resolver(""));
}

function recursiveChecker(
componentDir: string,
resolver: (...dirs: string[]) => string,
) {
const files = fs.readdirSync(resolver(componentDir));
files.forEach((file) => {
if (fs.lstatSync(resolver(componentDir, file)).isDirectory()) {
if (
file === "__tests__" ||
file === "__mocks__" ||
file === "__snapshots__"
) {
return;
}

recursiveChecker(resolver(componentDir, file), resolver);
return;
}

if (/\.test\.tsx?$/g.test(file) && /\.d\.tsx?$/g.test(file)) {
return;
}

const content = fs.readFileSync(resolver(componentDir, file)).toString();

if (content.split("\n")[0].includes("//ignore-localize")) return;
Expand Down

0 comments on commit 85698c9

Please sign in to comment.