4
4
namespace ts {
5
5
describe ( "convertTypeAcquisitionFromJson" , ( ) => {
6
6
function assertTypeAcquisition ( json : any , configFileName : string , expectedResult : { typeAcquisition : TypeAcquisition , errors : Diagnostic [ ] } ) {
7
- const { options : actualTypeAcquisition , errors : actualErrors } = convertTypeAcquisitionFromJson ( json [ "typeAcquisition" ] , "/apath/" , configFileName ) ;
7
+ const jsonOptions = json [ "typeAcquisition" ] || json [ "typingOptions" ] ;
8
+ const { options : actualTypeAcquisition , errors : actualErrors } = convertTypeAcquisitionFromJson ( jsonOptions , "/apath/" , configFileName ) ;
8
9
const parsedTypeAcquisition = JSON . stringify ( actualTypeAcquisition ) ;
9
10
const expectedTypeAcquisition = JSON . stringify ( expectedResult . typeAcquisition ) ;
10
11
assert . equal ( parsedTypeAcquisition , expectedTypeAcquisition ) ;
@@ -20,7 +21,29 @@ namespace ts {
20
21
}
21
22
22
23
// tsconfig.json
23
- it ( "Convert correctly format tsconfig.json to typing-options " , ( ) => {
24
+ it ( "Convert deprecated typingOptions.enableAutoDiscovery format tsconfig.json to typeAcquisition " , ( ) => {
25
+ assertTypeAcquisition (
26
+ {
27
+ "typingOptions" :
28
+ {
29
+ "enableAutoDiscovery" : true ,
30
+ "include" : [ "0.d.ts" , "1.d.ts" ] ,
31
+ "exclude" : [ "0.js" , "1.js" ]
32
+ }
33
+ } ,
34
+ "tsconfig.json" ,
35
+ {
36
+ typeAcquisition :
37
+ {
38
+ enable : true ,
39
+ include : [ "0.d.ts" , "1.d.ts" ] ,
40
+ exclude : [ "0.js" , "1.js" ]
41
+ } ,
42
+ errors : < Diagnostic [ ] > [ ]
43
+ } ) ;
44
+ } ) ;
45
+
46
+ it ( "Convert correctly format tsconfig.json to typeAcquisition " , ( ) => {
24
47
assertTypeAcquisition (
25
48
{
26
49
"typeAcquisition" :
@@ -42,7 +65,7 @@ namespace ts {
42
65
} ) ;
43
66
} ) ;
44
67
45
- it ( "Convert incorrect format tsconfig.json to typing-options " , ( ) => {
68
+ it ( "Convert incorrect format tsconfig.json to typeAcquisition " , ( ) => {
46
69
assertTypeAcquisition (
47
70
{
48
71
"typeAcquisition" :
@@ -70,7 +93,7 @@ namespace ts {
70
93
} ) ;
71
94
} ) ;
72
95
73
- it ( "Convert default tsconfig.json to typing-options " , ( ) => {
96
+ it ( "Convert default tsconfig.json to typeAcquisition " , ( ) => {
74
97
assertTypeAcquisition ( { } , "tsconfig.json" ,
75
98
{
76
99
typeAcquisition :
@@ -83,7 +106,7 @@ namespace ts {
83
106
} ) ;
84
107
} ) ;
85
108
86
- it ( "Convert tsconfig.json with only enable property to typing-options " , ( ) => {
109
+ it ( "Convert tsconfig.json with only enable property to typeAcquisition " , ( ) => {
87
110
assertTypeAcquisition (
88
111
{
89
112
"typeAcquisition" :
@@ -103,7 +126,7 @@ namespace ts {
103
126
} ) ;
104
127
105
128
// jsconfig.json
106
- it ( "Convert jsconfig.json to typing-options " , ( ) => {
129
+ it ( "Convert jsconfig.json to typeAcquisition " , ( ) => {
107
130
assertTypeAcquisition (
108
131
{
109
132
"typeAcquisition" :
@@ -124,7 +147,7 @@ namespace ts {
124
147
} ) ;
125
148
} ) ;
126
149
127
- it ( "Convert default jsconfig.json to typing-options " , ( ) => {
150
+ it ( "Convert default jsconfig.json to typeAcquisition " , ( ) => {
128
151
assertTypeAcquisition ( { } , "jsconfig.json" ,
129
152
{
130
153
typeAcquisition :
@@ -137,7 +160,7 @@ namespace ts {
137
160
} ) ;
138
161
} ) ;
139
162
140
- it ( "Convert incorrect format jsconfig.json to typing-options " , ( ) => {
163
+ it ( "Convert incorrect format jsconfig.json to typeAcquisition " , ( ) => {
141
164
assertTypeAcquisition (
142
165
{
143
166
"typeAcquisition" :
@@ -165,7 +188,7 @@ namespace ts {
165
188
} ) ;
166
189
} ) ;
167
190
168
- it ( "Convert jsconfig.json with only enable property to typing-options " , ( ) => {
191
+ it ( "Convert jsconfig.json with only enable property to typeAcquisition " , ( ) => {
169
192
assertTypeAcquisition (
170
193
{
171
194
"typeAcquisition" :
0 commit comments