File tree Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -480,4 +480,52 @@ describe('trueAffected', () => {
480480 'Added package proj2 to affected packages'
481481 ) ;
482482 } ) ;
483+
484+ it ( 'should support compilerOptions' , async ( ) => {
485+ jest . spyOn ( git , 'getChangedFiles' ) . mockReturnValue ( [
486+ {
487+ filePath : 'proj1/index.ts' ,
488+ changedLines : [ 4 ] ,
489+ } ,
490+ ] ) ;
491+
492+ const compilerOptions = {
493+ paths : {
494+ "@monorepo/proj1" : [
495+ "./proj1/index.ts"
496+ ] ,
497+ "@monorepo/proj2" : [
498+ "./proj2/index.ts"
499+ ] ,
500+ "@monorepo/proj3" : [
501+ "./proj3/index.ts"
502+ ] ,
503+ }
504+ }
505+
506+ const affected = await trueAffected ( {
507+ cwd,
508+ base : 'main' ,
509+ projects : [
510+ {
511+ name : 'proj1' ,
512+ sourceRoot : 'proj1/' ,
513+ tsConfig : 'proj1/tsconfig.json' ,
514+ } ,
515+ {
516+ name : 'proj2' ,
517+ sourceRoot : 'proj2/' ,
518+ tsConfig : 'proj2/tsconfig.json' ,
519+ } ,
520+ {
521+ name : 'proj3' ,
522+ sourceRoot : 'proj3/' ,
523+ tsConfig : 'proj3/tsconfig.json' ,
524+ } ,
525+ ] ,
526+ compilerOptions
527+ } ) ;
528+
529+ expect ( affected ) . toEqual ( [ 'proj1' ] ) ;
530+ } )
483531} ) ;
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ export const trueAffected = async ({
3434 projects,
3535 include = [ DEFAULT_INCLUDE_TEST_FILES ] ,
3636 logger = DEFAULT_LOGGER ,
37+ compilerOptions = { } ,
3738 __experimentalLockfileCheck = false ,
3839} : TrueAffected ) => {
3940 logger . debug ( 'Getting affected projects' ) ;
@@ -48,6 +49,7 @@ export const trueAffected = async ({
4849 const project = new Project ( {
4950 compilerOptions : {
5051 allowJs : true ,
52+ ...compilerOptions
5153 } ,
5254 ...( rootTsConfig == null
5355 ? { }
Original file line number Diff line number Diff line change 1+ import { CompilerOptions } from 'ts-morph' ;
2+
13export interface TrueAffectedProject {
24 name : string ;
35 sourceRoot : string ;
@@ -16,6 +18,7 @@ export interface TrueAffected extends TrueAffectedLogging {
1618 base ?: string ;
1719 projects : TrueAffectedProject [ ] ;
1820 include ?: ( string | RegExp ) [ ] ;
21+ compilerOptions ?: CompilerOptions ;
1922
2023 // **experimental** - this is an experimental feature and may be removed or changed at any time
2124 __experimentalLockfileCheck ?: boolean ;
You can’t perform that action at this time.
0 commit comments