/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/build/src/builders/karma/coverage.ts
34 строки
1007 B
cexbrayat
fix(@angular/build): exclude .angular from coverage instrumentation
24 сен 2025, 17:05
24 сен 2025, 17:05
3478aa3
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import path from 'node:path'; import { globSync } from 'tinyglobby'; export function createInstrumentationFilter(includedBasePath: string, excludedPaths: Set<string>) { return (request: string): boolean => { return ( !excludedPaths.has(request) && !/\.(e2e|spec)\.tsx?$|[\\/]node_modules[\\/]|[\\/]\.angular[\\/]/.test(request) && request.startsWith(includedBasePath) ); }; } export function getInstrumentationExcludedPaths( root: string, excludedPaths: string[], ): Set<string> { const excluded = new Set<string>(); for (const excludeGlob of excludedPaths) { const excludePath = excludeGlob[0] === '/' ? excludeGlob.slice(1) : excludeGlob; globSync(excludePath, { cwd: root }).forEach((p) => excluded.add(path.join(root, p))); } return excluded; }