* Check if file matches `coverage.include` but not `coverage.exclude`
(_filename: string, root?: string)
| 147 | * Check if file matches `coverage.include` but not `coverage.exclude` |
| 148 | */ |
| 149 | isIncluded(_filename: string, root?: string): boolean { |
| 150 | const roots = root ? [root] : this.roots |
| 151 | |
| 152 | const filename = slash(cleanUrl(_filename)) |
| 153 | const cacheHit = this.globCache.get(filename) |
| 154 | |
| 155 | if (cacheHit !== undefined) { |
| 156 | return cacheHit |
| 157 | } |
| 158 | |
| 159 | // File outside project root with default allowExternal |
| 160 | if (this.options.allowExternal === false && roots.every(root => !filename.startsWith(root))) { |
| 161 | this.globCache.set(filename, false) |
| 162 | |
| 163 | return false |
| 164 | } |
| 165 | |
| 166 | // By default `coverage.include` matches all files, except "coverage.exclude" |
| 167 | const glob = this.options.include || '**' |
| 168 | |
| 169 | let included = pm.isMatch(filename, glob, { |
| 170 | contains: true, |
| 171 | dot: true, |
| 172 | ignore: this.options.exclude, |
| 173 | }) |
| 174 | |
| 175 | if (included && this.changedFiles) { |
| 176 | included = this.changedFiles.includes(filename) |
| 177 | } |
| 178 | |
| 179 | this.globCache.set(filename, included) |
| 180 | |
| 181 | return included |
| 182 | } |
| 183 | |
| 184 | private async getUntestedFilesByRoot( |
| 185 | testedFiles: string[], |
no test coverage detected