@@ -100,12 +100,16 @@ export const eslintCategories: CategoryConfig[] = [
100100export function getJsDocsCategories (
101101 config : JsDocsPluginConfig ,
102102) : CategoryConfig [ ] {
103+ const filterOptions =
104+ typeof config === 'string' || Array . isArray ( config )
105+ ? { }
106+ : { onlyAudits : config . onlyAudits , skipAudits : config . skipAudits } ;
103107 return [
104108 {
105109 slug : 'docs' ,
106110 title : 'Documentation' ,
107111 description : 'Measures how much of your code is **documented**.' ,
108- refs : filterGroupsByOnlyAudits ( groups , config ) . map ( group => ( {
112+ refs : filterGroupsByOnlyAudits ( groups , filterOptions ) . map ( group => ( {
109113 weight : 1 ,
110114 type : 'group' ,
111115 plugin : PLUGIN_SLUG ,
@@ -159,12 +163,13 @@ export const jsDocsCoreConfig = (
159163
160164export const eslintCoreConfigNx = async (
161165 projectName ?: string ,
166+ options ?: { exclude ?: string [ ] } ,
162167) : Promise < CoreConfig > => ( {
163168 plugins : [
164169 await eslintPlugin (
165170 await ( projectName
166171 ? eslintConfigFromNxProject ( projectName )
167- : eslintConfigFromAllNxProjects ( ) ) ,
172+ : eslintConfigFromAllNxProjects ( options ) ) ,
168173 ) ,
169174 ] ,
170175 categories : eslintCategories ,
@@ -178,13 +183,42 @@ export const typescriptPluginConfig = async (
178183} ) ;
179184
180185export const coverageCoreConfigNx = async (
181- projectName ?: string ,
186+ projectOrConfig ?:
187+ | string
188+ | {
189+ projectName : string ;
190+ targetNames : string [ ] ;
191+ } ,
192+ options ?: { exclude ?: string [ ] } ,
182193) : Promise < CoreConfig > => {
194+ const projectName =
195+ typeof projectOrConfig === 'string'
196+ ? projectOrConfig
197+ : projectOrConfig ?. projectName ;
198+ const targetNames =
199+ typeof projectOrConfig === 'object' && projectOrConfig ?. targetNames ?. length
200+ ? projectOrConfig . targetNames
201+ : [ 'unit-test' , 'int-test' ] ;
202+
183203 if ( projectName ) {
184204 throw new Error ( 'coverageCoreConfigNx for single projects not implemented' ) ;
185205 }
186- const targetNames = [ 'unit-test' , 'int-test' ] ;
206+
187207 const targetArgs = [ '-t' , ...targetNames ] ;
208+
209+ // Compute projects list and apply exclude for efficient run-many execution
210+ const { createProjectGraphAsync } = await import ( '@nx/devkit' ) ;
211+ const { nodes } = await createProjectGraphAsync ( { exitOnError : false } ) ;
212+ const projectsWithTargets = Object . values ( nodes ) . filter ( node =>
213+ targetNames . some ( t => node . data . targets && t in node . data . targets ) ,
214+ ) ;
215+ const filteredProjects = options ?. exclude ?. length
216+ ? projectsWithTargets . filter ( node => ! options . exclude ! . includes ( node . name ) )
217+ : projectsWithTargets ;
218+ const projectsArg = `--projects=${ filteredProjects
219+ . map ( p => p . name )
220+ . join ( ',' ) } `;
221+
188222 return {
189223 plugins : [
190224 await coveragePlugin ( {
@@ -194,9 +228,10 @@ export const coverageCoreConfigNx = async (
194228 'nx' ,
195229 projectName ? `run --project ${ projectName } ` : 'run-many' ,
196230 ...targetArgs ,
231+ projectsArg ,
197232 ] ,
198233 } ,
199- reports : await getNxCoveragePaths ( targetNames ) ,
234+ reports : await getNxCoveragePaths ( targetNames , false , options ?. exclude ) ,
200235 } ) ,
201236 ] ,
202237 categories : coverageCategories ,
0 commit comments