(relativePath: string)
| 94 | } |
| 95 | |
| 96 | ignores(relativePath: string): boolean { |
| 97 | if (!relativePath || relativePath === '.' || relativePath === '..') { |
| 98 | return false; |
| 99 | } |
| 100 | |
| 101 | const normalizedPath = relativePath.split(sep).join('/'); |
| 102 | |
| 103 | if (this.rootIgnore.ignores(normalizedPath)) { |
| 104 | return true; |
| 105 | } |
| 106 | |
| 107 | const dir = dirname(normalizedPath); |
| 108 | if (dir === '.') return false; |
| 109 | |
| 110 | const parts = dir.split('/'); |
| 111 | |
| 112 | for (let i = 0; i <= parts.length; i++) { |
| 113 | const checkPath = parts.slice(0, i).join('/') || '.'; |
| 114 | const nestedIgnore = this.nestedIgnores.get(checkPath); |
| 115 | |
| 116 | if (nestedIgnore) { |
| 117 | let relativeToNested: string; |
| 118 | if (checkPath === '.') { |
| 119 | relativeToNested = normalizedPath; |
| 120 | } else { |
| 121 | relativeToNested = normalizedPath.substring(checkPath.length + 1); |
| 122 | } |
| 123 | |
| 124 | if (nestedIgnore.ignores(relativeToNested)) { |
| 125 | return true; |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | return false; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Filter a list of file paths |
no outgoing calls
no test coverage detected