Skip to content

Commit 01b6b5d

Browse files
authored
JS-822 Enable type-checking for single-file analysis (#5860)
1 parent e682e4b commit 01b6b5d

86 files changed

Lines changed: 1343 additions & 258 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

its/plugin/fast-tests/src/test/java/com/sonar/javascript/it/plugin/ReferencedTSConfigTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ void test() {
4646
result
4747
.logOutput()
4848
.stream()
49-
.filter(l -> l.message().matches("TypeScript(\\(\\d\\.\\d\\.\\d\\))? configuration file.*"))
49+
.filter(l ->
50+
l
51+
.message()
52+
.matches(
53+
"Creating TypeScript(\\(\\d\\.\\d\\.\\d\\))? program with configuration file.*"
54+
)
55+
)
5056
).hasSize(2);
5157
}
5258
}

its/plugin/fast-tests/src/test/java/com/sonar/javascript/it/plugin/TypeCheckerConfigTest.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,16 @@ void multiple_targets() {
7272
.extracting(Log::message)
7373
.filteredOn(m -> m.startsWith("Found 1 tsconfig.json file(s)"))
7474
.hasSize(1);
75-
assertThat(result.logOutput())
76-
.extracting(Log::message)
77-
.filteredOn(m ->
78-
m.equals(
79-
"Found 1 file(s) not part of any tsconfig.json: they will be analyzed without type information"
75+
assertThat(
76+
result
77+
.logOutput()
78+
.stream()
79+
.filter(l ->
80+
l
81+
.message()
82+
.matches("Creating TypeScript(\\(\\d\\.\\d\\.\\d\\))? program from entry point.*")
8083
)
81-
)
82-
.hasSize(1);
84+
).hasSize(1);
8385

8486
var issues = result
8587
.scannerOutputReader()

its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeScriptAnalysisTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,7 @@ void should_exclude_from_extended_tsconfig() throws Exception {
247247

248248
assertThat(
249249
result.getLogsLines(l ->
250-
l.contains(
251-
"INFO: Found 1 file(s) not part of any tsconfig.json: they will be analyzed without type information"
252-
)
253-
)
254-
).hasSize(1);
255-
assertThat(
256-
result.getLogsLines(l ->
257-
l.contains("File not part of any tsconfig.json: dir/file.excluded.ts")
250+
l.matches(".*Creating TypeScript(\\(\\d\\.\\d\\.\\d\\))? program from entry point.*")
258251
)
259252
).hasSize(1);
260253
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"TypeScript:scripts/mocha-parallel.js": [
3+
359
4+
]
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"TypeScript:lib/tsc.js": [
3+
47353,
4+
48006,
5+
48316
6+
]
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"TypeScript:Jakefile.js": [
3+
821
4+
]
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"TypeScript:lib/tsc.js": [
3+
935,
4+
4077,
5+
6973,
6+
36581,
7+
36592,
8+
38926,
9+
48587,
10+
48593
11+
],
12+
"TypeScript:lib/typingsInstaller.js": [
13+
945,
14+
4087
15+
]
16+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"TypeScript:lib/tsc.js": [
3+
21324,
4+
21647,
5+
24458,
6+
27089,
7+
28494,
8+
29121,
9+
29465,
10+
30166,
11+
30329,
12+
30454,
13+
30469,
14+
36112,
15+
38034,
16+
43431,
17+
44314
18+
]
19+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"TypeScript:Jakefile.js": [
3+
381,
4+
703
5+
]
6+
}
Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
{
2+
"TypeScript:Jakefile.js": [
3+
44
4+
],
5+
"TypeScript:lib/tsc.js": [
6+
116,
7+
120,
8+
756,
9+
762,
10+
1090,
11+
1399,
12+
1473,
13+
1475,
14+
1575,
15+
1676,
16+
1779,
17+
2414,
18+
4953,
19+
4990,
20+
5183,
21+
5192,
22+
5320,
23+
5552,
24+
5565,
25+
5568,
26+
5666,
27+
5670,
28+
5680,
29+
5684,
30+
6061,
31+
6145,
32+
6231,
33+
6239,
34+
6240,
35+
6284,
36+
6309,
37+
6310,
38+
6318,
39+
6370,
40+
6373,
41+
6990,
42+
7014,
43+
7203,
44+
7263,
45+
7507,
46+
7538,
47+
8554,
48+
8579,
49+
8583,
50+
8595,
51+
8599,
52+
9623,
53+
10679,
54+
10680,
55+
10713,
56+
10723,
57+
10733,
58+
10734,
59+
10746,
60+
10756,
61+
10770,
62+
10784,
63+
10825,
64+
10830,
65+
11629,
66+
11630,
67+
11679,
68+
12451,
69+
16399,
70+
17497,
71+
17499,
72+
17540,
73+
17545,
74+
17575,
75+
18214,
76+
18674,
77+
18985,
78+
18988,
79+
19003,
80+
19014,
81+
19036,
82+
19068,
83+
19134,
84+
19134,
85+
20086,
86+
20114,
87+
20191,
88+
20230,
89+
20231,
90+
20400,
91+
20592,
92+
20640,
93+
20654,
94+
20660,
95+
21331,
96+
21400,
97+
21419,
98+
21483,
99+
21528,
100+
21730,
101+
22009,
102+
22054,
103+
22069,
104+
22252,
105+
22558,
106+
22559,
107+
22717,
108+
22749,
109+
22857,
110+
22926,
111+
22934,
112+
22939,
113+
23401,
114+
23428,
115+
23444,
116+
23634,
117+
23725,
118+
24100,
119+
24130,
120+
24408,
121+
24734,
122+
25444,
123+
25497,
124+
25614,
125+
25641,
126+
25832,
127+
26041,
128+
26044,
129+
26523,
130+
26586,
131+
26597,
132+
26805,
133+
26907,
134+
27085,
135+
27145,
136+
30033,
137+
30419,
138+
30446,
139+
30461,
140+
30470,
141+
30476,
142+
30619,
143+
31095,
144+
31835,
145+
32026,
146+
32055,
147+
32160,
148+
32240,
149+
32691,
150+
32857,
151+
32931,
152+
33009,
153+
33134,
154+
33302,
155+
33317,
156+
34009,
157+
35193,
158+
35352,
159+
35598,
160+
35725,
161+
37131,
162+
37484,
163+
37491,
164+
37494,
165+
37661,
166+
37690,
167+
37953,
168+
38260,
169+
38292,
170+
38298,
171+
38656,
172+
38667,
173+
38759,
174+
38789,
175+
38959,
176+
40910,
177+
41064,
178+
41152,
179+
41686,
180+
41698,
181+
43633,
182+
43934,
183+
44204,
184+
44570,
185+
44761,
186+
45278,
187+
46088,
188+
46102,
189+
46262,
190+
46337,
191+
47543,
192+
47604,
193+
48421,
194+
48424,
195+
48530,
196+
48552,
197+
48912,
198+
48913,
199+
48938,
200+
48939,
201+
48940,
202+
49058,
203+
49059,
204+
49105,
205+
49116,
206+
49558,
207+
50184,
208+
50201,
209+
50344,
210+
50787,
211+
51494,
212+
52617,
213+
52665,
214+
53018,
215+
53584,
216+
54009,
217+
54088,
218+
54254,
219+
55192,
220+
55384,
221+
55501,
222+
55657,
223+
55838,
224+
56213,
225+
56269,
226+
56269
227+
],
228+
"TypeScript:lib/typingsInstaller.js": [
229+
126,
230+
130,
231+
766,
232+
772,
233+
1100,
234+
1409,
235+
1483,
236+
1485,
237+
1585,
238+
1686,
239+
1789,
240+
2424,
241+
5529,
242+
5721,
243+
5838,
244+
5994,
245+
6175,
246+
6260,
247+
6576,
248+
6604,
249+
6681,
250+
6720,
251+
6721,
252+
6890,
253+
7082,
254+
7130,
255+
7144,
256+
7150,
257+
7215,
258+
7705,
259+
7705
260+
]
261+
}

0 commit comments

Comments
 (0)