1
1
import { describe , expect , it } from "vitest" ;
2
2
3
+ import { RawTypeStatOptions } from "../../options/types.js" ;
3
4
import { InitializationCleanups } from "./cleanups.js" ;
4
- import { createJavaScriptConfig } from "./createJavaScriptConfig.js" ;
5
+ import {
6
+ createJavaScriptConfig ,
7
+ JavaScriptConfigSettings ,
8
+ } from "./createJavaScriptConfig.js" ;
5
9
import { InitializationImports } from "./imports.js" ;
6
10
import { InitializationRenames } from "./renames.js" ;
7
11
12
+ interface TestArguments {
13
+ expected : RawTypeStatOptions | RawTypeStatOptions [ ] ;
14
+ name : string ;
15
+ settings : JavaScriptConfigSettings ;
16
+ }
17
+
8
18
describe ( "createJavaScriptConfig" , ( ) => {
9
- it . each ( [
19
+ it . each < TestArguments > ( [
10
20
{
11
21
expected : {
12
22
files : { renameExtensions : "ts" } ,
@@ -15,7 +25,7 @@ describe("createJavaScriptConfig", () => {
15
25
missingProperties : true ,
16
26
noImplicitAny : true ,
17
27
} ,
18
- project : "tsconfig.json" ,
28
+ projectPath : "tsconfig.json" ,
19
29
} ,
20
30
name : "Basic" ,
21
31
settings : {
@@ -36,7 +46,7 @@ describe("createJavaScriptConfig", () => {
36
46
missingProperties : true ,
37
47
noImplicitAny : true ,
38
48
} ,
39
- project : "tsconfig.json" ,
49
+ projectPath : "tsconfig.json" ,
40
50
} ,
41
51
name : "Basic with Suppressions" ,
42
52
settings : {
@@ -54,7 +64,7 @@ describe("createJavaScriptConfig", () => {
54
64
files : { renameExtensions : "ts" } ,
55
65
fixes : { importExtensions : true } ,
56
66
include : [ "src/**/*.{js,jsx}" ] ,
57
- project : "tsconfig.json" ,
67
+ projectPath : "tsconfig.json" ,
58
68
} ,
59
69
{
60
70
fixes : {
@@ -63,7 +73,7 @@ describe("createJavaScriptConfig", () => {
63
73
noImplicitAny : true ,
64
74
} ,
65
75
include : [ "src/**/*.ts" ] ,
66
- project : "tsconfig.json" ,
76
+ projectPath : "tsconfig.json" ,
67
77
} ,
68
78
] ,
69
79
name : "TS Renames (multiple sourceFiles extensions)" ,
@@ -83,7 +93,7 @@ describe("createJavaScriptConfig", () => {
83
93
files : { renameExtensions : "tsx" } ,
84
94
fixes : { importExtensions : true } ,
85
95
include : [ "src/**/*.{js,jsx}" ] ,
86
- project : "tsconfig.json" ,
96
+ projectPath : "tsconfig.json" ,
87
97
} ,
88
98
{
89
99
fixes : {
@@ -92,7 +102,7 @@ describe("createJavaScriptConfig", () => {
92
102
noImplicitAny : true ,
93
103
} ,
94
104
include : [ "src/**/*.tsx" ] ,
95
- project : "tsconfig.json" ,
105
+ projectPath : "tsconfig.json" ,
96
106
} ,
97
107
] ,
98
108
name : "TSX Renames (multiple sourceFiles extensions)" ,
@@ -111,15 +121,15 @@ describe("createJavaScriptConfig", () => {
111
121
{
112
122
files : { renameExtensions : true } ,
113
123
fixes : { importExtensions : true } ,
114
- project : "tsconfig.json" ,
124
+ projectPath : "tsconfig.json" ,
115
125
} ,
116
126
{
117
127
fixes : {
118
128
incompleteTypes : true ,
119
129
missingProperties : true ,
120
130
noImplicitAny : true ,
121
131
} ,
122
- project : "tsconfig.json" ,
132
+ projectPath : "tsconfig.json" ,
123
133
} ,
124
134
] ,
125
135
name : "Auto Renames (no sourceFiles)" ,
@@ -138,7 +148,7 @@ describe("createJavaScriptConfig", () => {
138
148
files : { renameExtensions : true } ,
139
149
fixes : { importExtensions : true } ,
140
150
include : [ "src/**/*.js" ] ,
141
- project : "tsconfig.json" ,
151
+ projectPath : "tsconfig.json" ,
142
152
} ,
143
153
{
144
154
fixes : {
@@ -147,7 +157,7 @@ describe("createJavaScriptConfig", () => {
147
157
noImplicitAny : true ,
148
158
} ,
149
159
include : [ "src/**/*.{ts,tsx}" ] ,
150
- project : "tsconfig.json" ,
160
+ projectPath : "tsconfig.json" ,
151
161
} ,
152
162
] ,
153
163
name : "Auto Renames (single sourceFiles extension)" ,
@@ -167,7 +177,7 @@ describe("createJavaScriptConfig", () => {
167
177
files : { renameExtensions : true } ,
168
178
fixes : { importExtensions : true } ,
169
179
include : [ "src/**/*.{js,jsx}" ] ,
170
- project : "tsconfig.json" ,
180
+ projectPath : "tsconfig.json" ,
171
181
} ,
172
182
{
173
183
fixes : {
@@ -176,7 +186,7 @@ describe("createJavaScriptConfig", () => {
176
186
noImplicitAny : true ,
177
187
} ,
178
188
include : [ "src/**/*.{ts,tsx}" ] ,
179
- project : "tsconfig.json" ,
189
+ projectPath : "tsconfig.json" ,
180
190
} ,
181
191
] ,
182
192
name : "Auto Renames (multiple sourceFiles extensions)" ,
@@ -196,7 +206,7 @@ describe("createJavaScriptConfig", () => {
196
206
files : { renameExtensions : true } ,
197
207
fixes : { importExtensions : true } ,
198
208
include : [ "src/**/*.js(x)" ] ,
199
- project : "tsconfig.json" ,
209
+ projectPath : "tsconfig.json" ,
200
210
} ,
201
211
{
202
212
fixes : {
@@ -205,7 +215,7 @@ describe("createJavaScriptConfig", () => {
205
215
noImplicitAny : true ,
206
216
} ,
207
217
include : [ "src/**/*.ts(x)" ] ,
208
- project : "tsconfig.json" ,
218
+ projectPath : "tsconfig.json" ,
209
219
} ,
210
220
] ,
211
221
name : "Auto Renames (parenthesized sourceFiles extensions)" ,
0 commit comments