@@ -1557,6 +1557,137 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
1557
1557
}
1558
1558
` ) ;
1559
1559
} ) ;
1560
+
1561
+ it ( 'should set the "tsBuildInfoFile" option when outside of the "outDir"' , async ( ) => {
1562
+ await applyFilesToTempFsAndContext ( tempFs , context , {
1563
+ 'libs/my-lib/tsconfig.json' : JSON . stringify ( {
1564
+ compilerOptions : {
1565
+ outDir : 'dist' ,
1566
+ tsBuildInfoFile : 'my-lib.tsbuildinfo' ,
1567
+ } ,
1568
+ files : [ 'main.ts' ] ,
1569
+ } ) ,
1570
+ 'libs/my-lib/package.json' : `{}` ,
1571
+ } ) ;
1572
+
1573
+ expect ( await invokeCreateNodesOnMatchingFiles ( context , { } ) )
1574
+ . toMatchInlineSnapshot ( `
1575
+ {
1576
+ "projects": {
1577
+ "libs/my-lib": {
1578
+ "projectType": "library",
1579
+ "targets": {
1580
+ "typecheck": {
1581
+ "cache": true,
1582
+ "command": "tsc --build --emitDeclarationOnly --pretty --verbose",
1583
+ "dependsOn": [
1584
+ "^typecheck",
1585
+ ],
1586
+ "inputs": [
1587
+ "production",
1588
+ "^production",
1589
+ {
1590
+ "externalDependencies": [
1591
+ "typescript",
1592
+ ],
1593
+ },
1594
+ ],
1595
+ "metadata": {
1596
+ "description": "Runs type-checking for the project.",
1597
+ "help": {
1598
+ "command": "npx tsc --build --help",
1599
+ "example": {
1600
+ "args": [
1601
+ "--force",
1602
+ ],
1603
+ },
1604
+ },
1605
+ "technologies": [
1606
+ "typescript",
1607
+ ],
1608
+ },
1609
+ "options": {
1610
+ "cwd": "libs/my-lib",
1611
+ },
1612
+ "outputs": [
1613
+ "{projectRoot}/dist",
1614
+ "{projectRoot}/my-lib.tsbuildinfo",
1615
+ ],
1616
+ "syncGenerators": [
1617
+ "@nx/js:typescript-sync",
1618
+ ],
1619
+ },
1620
+ },
1621
+ },
1622
+ },
1623
+ }
1624
+ ` ) ;
1625
+ } ) ;
1626
+
1627
+ it ( 'should not set the "tsBuildInfoFile" option when contained in the "outDir"' , async ( ) => {
1628
+ await applyFilesToTempFsAndContext ( tempFs , context , {
1629
+ 'libs/my-lib/tsconfig.json' : JSON . stringify ( {
1630
+ compilerOptions : {
1631
+ outDir : 'dist' ,
1632
+ tsBuildInfoFile : 'dist/my-lib.tsbuildinfo' ,
1633
+ } ,
1634
+ files : [ 'main.ts' ] ,
1635
+ } ) ,
1636
+ 'libs/my-lib/package.json' : `{}` ,
1637
+ } ) ;
1638
+
1639
+ expect ( await invokeCreateNodesOnMatchingFiles ( context , { } ) )
1640
+ . toMatchInlineSnapshot ( `
1641
+ {
1642
+ "projects": {
1643
+ "libs/my-lib": {
1644
+ "projectType": "library",
1645
+ "targets": {
1646
+ "typecheck": {
1647
+ "cache": true,
1648
+ "command": "tsc --build --emitDeclarationOnly --pretty --verbose",
1649
+ "dependsOn": [
1650
+ "^typecheck",
1651
+ ],
1652
+ "inputs": [
1653
+ "production",
1654
+ "^production",
1655
+ {
1656
+ "externalDependencies": [
1657
+ "typescript",
1658
+ ],
1659
+ },
1660
+ ],
1661
+ "metadata": {
1662
+ "description": "Runs type-checking for the project.",
1663
+ "help": {
1664
+ "command": "npx tsc --build --help",
1665
+ "example": {
1666
+ "args": [
1667
+ "--force",
1668
+ ],
1669
+ },
1670
+ },
1671
+ "technologies": [
1672
+ "typescript",
1673
+ ],
1674
+ },
1675
+ "options": {
1676
+ "cwd": "libs/my-lib",
1677
+ },
1678
+ "outputs": [
1679
+ "{projectRoot}/dist",
1680
+ ],
1681
+ "syncGenerators": [
1682
+ "@nx/js:typescript-sync",
1683
+ ],
1684
+ },
1685
+ },
1686
+ },
1687
+ },
1688
+ }
1689
+ ` ) ;
1690
+ } ) ;
1560
1691
} ) ;
1561
1692
} ) ;
1562
1693
@@ -2937,6 +3068,147 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2937
3068
}
2938
3069
` ) ;
2939
3070
} ) ;
3071
+
3072
+ it ( 'should set the "tsBuildInfoFile" option when outside of the "outDir"' , async ( ) => {
3073
+ await applyFilesToTempFsAndContext ( tempFs , context , {
3074
+ 'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
3075
+ compilerOptions : {
3076
+ outDir : 'dist' ,
3077
+ tsBuildInfoFile : 'my-lib.tsbuildinfo' ,
3078
+ } ,
3079
+ files : [ 'main.ts' ] ,
3080
+ } ) ,
3081
+ 'libs/my-lib/tsconfig.json' : `{}` ,
3082
+ 'libs/my-lib/package.json' : `{}` ,
3083
+ } ) ;
3084
+
3085
+ expect (
3086
+ await invokeCreateNodesOnMatchingFiles ( context , {
3087
+ typecheck : false ,
3088
+ build : true ,
3089
+ } )
3090
+ ) . toMatchInlineSnapshot ( `
3091
+ {
3092
+ "projects": {
3093
+ "libs/my-lib": {
3094
+ "projectType": "library",
3095
+ "targets": {
3096
+ "build": {
3097
+ "cache": true,
3098
+ "command": "tsc --build tsconfig.lib.json --pretty --verbose",
3099
+ "dependsOn": [
3100
+ "^build",
3101
+ ],
3102
+ "inputs": [
3103
+ "production",
3104
+ "^production",
3105
+ {
3106
+ "externalDependencies": [
3107
+ "typescript",
3108
+ ],
3109
+ },
3110
+ ],
3111
+ "metadata": {
3112
+ "description": "Builds the project with \`tsc\`.",
3113
+ "help": {
3114
+ "command": "npx tsc --build --help",
3115
+ "example": {
3116
+ "args": [
3117
+ "--force",
3118
+ ],
3119
+ },
3120
+ },
3121
+ "technologies": [
3122
+ "typescript",
3123
+ ],
3124
+ },
3125
+ "options": {
3126
+ "cwd": "libs/my-lib",
3127
+ },
3128
+ "outputs": [
3129
+ "{projectRoot}/dist",
3130
+ "{projectRoot}/my-lib.tsbuildinfo",
3131
+ ],
3132
+ "syncGenerators": [
3133
+ "@nx/js:typescript-sync",
3134
+ ],
3135
+ },
3136
+ },
3137
+ },
3138
+ },
3139
+ }
3140
+ ` ) ;
3141
+ } ) ;
3142
+
3143
+ it ( 'should not set the "tsBuildInfoFile" option when contained in the "outDir"' , async ( ) => {
3144
+ await applyFilesToTempFsAndContext ( tempFs , context , {
3145
+ 'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
3146
+ compilerOptions : {
3147
+ outDir : 'dist' ,
3148
+ tsBuildInfoFile : 'dist/my-lib.tsbuildinfo' ,
3149
+ } ,
3150
+ files : [ 'main.ts' ] ,
3151
+ } ) ,
3152
+ 'libs/my-lib/tsconfig.json' : `{}` ,
3153
+ 'libs/my-lib/package.json' : `{}` ,
3154
+ } ) ;
3155
+
3156
+ expect (
3157
+ await invokeCreateNodesOnMatchingFiles ( context , {
3158
+ typecheck : false ,
3159
+ build : true ,
3160
+ } )
3161
+ ) . toMatchInlineSnapshot ( `
3162
+ {
3163
+ "projects": {
3164
+ "libs/my-lib": {
3165
+ "projectType": "library",
3166
+ "targets": {
3167
+ "build": {
3168
+ "cache": true,
3169
+ "command": "tsc --build tsconfig.lib.json --pretty --verbose",
3170
+ "dependsOn": [
3171
+ "^build",
3172
+ ],
3173
+ "inputs": [
3174
+ "production",
3175
+ "^production",
3176
+ {
3177
+ "externalDependencies": [
3178
+ "typescript",
3179
+ ],
3180
+ },
3181
+ ],
3182
+ "metadata": {
3183
+ "description": "Builds the project with \`tsc\`.",
3184
+ "help": {
3185
+ "command": "npx tsc --build --help",
3186
+ "example": {
3187
+ "args": [
3188
+ "--force",
3189
+ ],
3190
+ },
3191
+ },
3192
+ "technologies": [
3193
+ "typescript",
3194
+ ],
3195
+ },
3196
+ "options": {
3197
+ "cwd": "libs/my-lib",
3198
+ },
3199
+ "outputs": [
3200
+ "{projectRoot}/dist",
3201
+ ],
3202
+ "syncGenerators": [
3203
+ "@nx/js:typescript-sync",
3204
+ ],
3205
+ },
3206
+ },
3207
+ },
3208
+ },
3209
+ }
3210
+ ` ) ;
3211
+ } ) ;
2940
3212
} ) ;
2941
3213
} ) ;
2942
3214
} ) ;
0 commit comments