@@ -101,114 +101,129 @@ export async function determinePaths(
101101 sourceRoot : projectConfiguration . sourceRoot ,
102102 testTarget : projectConfiguration . targets . test ,
103103 } ) ;
104-
105- deps . workspaceLibraries
106- . filter ( ( project ) =>
107- context . projectName === project . name || ( options . skipPaths . length ? options . skipPaths . some ( path => project . sourceRoot . includes ( path ) ) : true )
108- )
109- . filter ( ( project ) =>
110- context . projectName === project . name || ( options . skipProjects . length ? options . skipProjects . includes ( project . name ) : true )
104+ const workspaceLibraries = deps . workspaceLibraries
105+ . filter (
106+ ( project ) =>
107+ context . projectName === project . name ||
108+ ( options . skipPaths ?. length
109+ ? options . skipPaths . some ( ( path ) => project . sourceRoot . includes ( path ) )
110+ : true )
111111 )
112- . filter ( ( project ) =>
113- context . projectName === project . name || ( options . skipTypeDeps . length ? options . skipTypeDeps . includes ( project . type ) : true )
112+ . filter (
113+ ( project ) =>
114+ context . projectName === project . name ||
115+ ( options . skipProjects ?. length
116+ ? options . skipProjects . includes ( project . name )
117+ : true )
114118 )
115- . forEach ( ( dep ) => {
116- sources . push ( dep . sourceRoot ) ;
119+ . filter ( ( project ) => {
120+ if (
121+ context . projectName === project . name ||
122+ ! options . skipDependencyTypes ?. length
123+ ) {
124+ return true ;
125+ }
126+ return options . skipDependencyTypes . includes (
127+ project . type as 'implicit' | 'static' | 'dynamic'
128+ ) ;
129+ } ) ;
130+ workspaceLibraries . forEach ( ( dep ) => {
131+ sources . push ( dep . sourceRoot ) ;
117132
118- if ( dep . testTarget ) {
119- const testRunner : TestRunner = getTestRunner ( dep ) ;
120- const coverageDirectoryName : CoverageDirectoryName =
121- getCoverageDirectoryName ( testRunner ) ;
133+ if ( dep . testTarget ) {
134+ const testRunner : TestRunner = getTestRunner ( dep ) ;
135+ const coverageDirectoryName : CoverageDirectoryName =
136+ getCoverageDirectoryName ( testRunner ) ;
122137
123- if ( dep . testTarget . options ?. [ coverageDirectoryName ] ) {
138+ if ( dep . testTarget . options ?. [ coverageDirectoryName ] ) {
139+ lcovPaths . push (
140+ joinPathFragments (
141+ dep . testTarget . options [ coverageDirectoryName ]
142+ . replace ( new RegExp ( / ' / g) , '' )
143+ . replace ( / ^ (?: \. \. \/ ) + / , '' ) ,
144+ 'lcov.info'
145+ )
146+ ) ;
147+ } else if ( testRunner === TestRunner . Jest ) {
148+ const jestConfigPath : string = joinPathFragments (
149+ context . root ,
150+ dep . projectRoot ,
151+ 'jest.config.ts'
152+ ) ;
153+
154+ if ( ! existsSync ( jestConfigPath ) ) {
155+ logger . warn (
156+ `Skipping ${ dep . name } as the jest config file cannot be found`
157+ ) ;
158+ return ;
159+ }
160+
161+ const jestConfig = readFileSync ( jestConfigPath , 'utf-8' ) ;
162+ const ast = tsquery . ast ( jestConfig ) ;
163+ const nodes = tsquery (
164+ ast ,
165+ 'Identifier[name="coverageDirectory"] ~ StringLiteral' ,
166+ { visitAllChildren : true }
167+ ) ;
168+
169+ if ( nodes . length ) {
124170 lcovPaths . push (
125171 joinPathFragments (
126- dep . testTarget . options [ coverageDirectoryName ]
172+ nodes [ 0 ]
173+ . getText ( )
127174 . replace ( new RegExp ( / ' / g) , '' )
128175 . replace ( / ^ (?: \. \. \/ ) + / , '' ) ,
129176 'lcov.info'
130177 )
131178 ) ;
132- } else if ( testRunner === TestRunner . Jest ) {
133- const jestConfigPath : string = joinPathFragments (
134- context . root ,
135- dep . projectRoot ,
136- 'jest.config.ts'
137- ) ;
138-
139- if ( ! existsSync ( jestConfigPath ) ) {
140- logger . warn (
141- `Skipping ${ dep . name } as the jest config file cannot be found`
142- ) ;
143- return ;
144- }
145-
146- const jestConfig = readFileSync ( jestConfigPath , 'utf-8' ) ;
147- const ast = tsquery . ast ( jestConfig ) ;
148- const nodes = tsquery (
149- ast ,
150- 'Identifier[name="coverageDirectory"] ~ StringLiteral' ,
151- { visitAllChildren : true }
179+ } else {
180+ logger . warn (
181+ `Skipping ${ dep . name } as it does not have a coverageDirectory in ${ jestConfigPath } `
152182 ) ;
183+ }
184+ } else if ( TestRunner . Vitest ) {
185+ const viteConfigPath : string = joinPathFragments (
186+ context . root ,
187+ dep . projectRoot ,
188+ 'vite.config.ts'
189+ ) ;
153190
154- if ( nodes . length ) {
155- lcovPaths . push (
156- joinPathFragments (
157- nodes [ 0 ]
158- . getText ( )
159- . replace ( new RegExp ( / ' / g) , '' )
160- . replace ( / ^ (?: \. \. \/ ) + / , '' ) ,
161- 'lcov.info'
162- )
163- ) ;
164- } else {
165- logger . warn (
166- `Skipping ${ dep . name } as it does not have a coverageDirectory in ${ jestConfigPath } `
167- ) ;
168- }
169- } else if ( TestRunner . Vitest ) {
170- const viteConfigPath : string = joinPathFragments (
171- context . root ,
172- dep . projectRoot ,
173- 'vite.config.ts'
191+ if ( ! existsSync ( viteConfigPath ) ) {
192+ logger . warn (
193+ `Skipping ${ dep . name } as the vite config file cannot be found`
174194 ) ;
175195
176- if ( ! existsSync ( viteConfigPath ) ) {
177- logger . warn (
178- `Skipping ${ dep . name } as the vite config file cannot be found`
179- ) ;
196+ return ;
197+ }
180198
181- return ;
182- }
199+ const config = readFileSync ( viteConfigPath , 'utf-8' ) ;
200+ const ast = tsquery . ast ( config ) ;
201+ const nodes = tsquery (
202+ ast ,
203+ 'Identifier[name="reportsDirectory"] ~ StringLiteral' ,
204+ { visitAllChildren : true }
205+ ) ;
183206
184- const config = readFileSync ( viteConfigPath , 'utf-8' ) ;
185- const ast = tsquery . ast ( config ) ;
186- const nodes = tsquery (
187- ast ,
188- 'Identifier[name="reportsDirectory"] ~ StringLiteral' ,
189- { visitAllChildren : true }
207+ if ( nodes . length ) {
208+ lcovPaths . push (
209+ joinPathFragments (
210+ nodes [ 0 ]
211+ . getText ( )
212+ . replace ( new RegExp ( / ' / g) , '' )
213+ . replace ( / ^ (?: \. \. \/ ) + / , '' ) ,
214+ 'lcov.info'
215+ )
216+ ) ;
217+ } else {
218+ logger . warn (
219+ `Skipping ${ dep . name } as it does not have a reportsDirectory in ${ viteConfigPath } `
190220 ) ;
191-
192- if ( nodes . length ) {
193- lcovPaths . push (
194- joinPathFragments (
195- nodes [ 0 ]
196- . getText ( )
197- . replace ( new RegExp ( / ' / g) , '' )
198- . replace ( / ^ (?: \. \. \/ ) + / , '' ) ,
199- 'lcov.info'
200- )
201- ) ;
202- } else {
203- logger . warn (
204- `Skipping ${ dep . name } as it does not have a reportsDirectory in ${ viteConfigPath } `
205- ) ;
206- }
207221 }
208- } else {
209- logger . warn ( `Skipping ${ dep . name } as it does not have a test target` ) ;
210222 }
211- } ) ;
223+ } else {
224+ logger . warn ( `Skipping ${ dep . name } as it does not have a test target` ) ;
225+ }
226+ } ) ;
212227
213228 return Promise . resolve ( {
214229 lcovPaths : lcovPaths . join ( ',' ) ,
0 commit comments