Skip to content

Commit 7a66a41

Browse files
chuckjazIgorMinar
authored andcommitted
test(language-service): test @angular/language-service can be loaded by tsserver.js (angular#14721)
1 parent 79fc1e3 commit 7a66a41

21 files changed

+833
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.js
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Angular Language Service Test
2+
3+
This directory is an integration test for `@angular/language-service` to ensure
4+
that various versions of the server can be loaded in the supported versions of
5+
TypeScript's language service.
6+
7+
## New supported version of TypeScript
8+
9+
To add a new supported version of TypeScript:
10+
11+
1) Create directory in `typescripts` to hold the new version following the pattern
12+
of the other versions.
13+
2) Add the directory name to the end of the `TYPESCRIPTS` variable in the
14+
`scripts/env.sh` file.
15+
3) Run `scripts/update_golden.sh` to generate the expected files.
16+
4) Verify the expected output is reasonable by comparing to a known good output
17+
from a previous version.
18+
19+
## Update golden files
20+
21+
If the expected output needs to be updated run `scripts/update_golden.sh` to
22+
update the expected output of the server.
23+
24+
## Adding a new fixture
25+
26+
Currently there is no automated way to produce a new fixture. The way the
27+
current fixtures were created was to hack a version of tsserver.js to write the
28+
commands from `VSCode` to a file while performing the operation to be tested.
29+
I also hand modified the input to remove superfluous request.
30+
31+
Once a new fixture is created:
32+
33+
1) Add the fixture base name (without the .json) to `FIXTURES` in
34+
`scripts/env.sh`.
35+
2) Run `scripts/udpate_golden.sh` to produce the expected output files.
36+
3) Hand validate the expected output is reasonable.
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
[
2+
{
3+
"type": "response",
4+
"command": "configure",
5+
"success": true
6+
},
7+
{
8+
"type": "response",
9+
"command": "compilerOptionsForInferredProjects",
10+
"success": true,
11+
"body": true
12+
},
13+
{
14+
"type": "response",
15+
"command": "completions",
16+
"success": true,
17+
"body": [
18+
{
19+
"name": "anchor",
20+
"kind": "method",
21+
"kindModifiers": "",
22+
"sortText": "anchor"
23+
},
24+
{
25+
"name": "big",
26+
"kind": "method",
27+
"kindModifiers": "",
28+
"sortText": "big"
29+
},
30+
{
31+
"name": "blink",
32+
"kind": "method",
33+
"kindModifiers": "",
34+
"sortText": "blink"
35+
},
36+
{
37+
"name": "bold",
38+
"kind": "method",
39+
"kindModifiers": "",
40+
"sortText": "bold"
41+
},
42+
{
43+
"name": "charAt",
44+
"kind": "method",
45+
"kindModifiers": "",
46+
"sortText": "charAt"
47+
},
48+
{
49+
"name": "charCodeAt",
50+
"kind": "method",
51+
"kindModifiers": "",
52+
"sortText": "charCodeAt"
53+
},
54+
{
55+
"name": "codePointAt",
56+
"kind": "method",
57+
"kindModifiers": "",
58+
"sortText": "codePointAt"
59+
},
60+
{
61+
"name": "concat",
62+
"kind": "method",
63+
"kindModifiers": "",
64+
"sortText": "concat"
65+
},
66+
{
67+
"name": "endsWith",
68+
"kind": "method",
69+
"kindModifiers": "",
70+
"sortText": "endsWith"
71+
},
72+
{
73+
"name": "fixed",
74+
"kind": "method",
75+
"kindModifiers": "",
76+
"sortText": "fixed"
77+
},
78+
{
79+
"name": "fontcolor",
80+
"kind": "method",
81+
"kindModifiers": "",
82+
"sortText": "fontcolor"
83+
},
84+
{
85+
"name": "fontsize",
86+
"kind": "method",
87+
"kindModifiers": "",
88+
"sortText": "fontsize"
89+
},
90+
{
91+
"name": "includes",
92+
"kind": "method",
93+
"kindModifiers": "",
94+
"sortText": "includes"
95+
},
96+
{
97+
"name": "indexOf",
98+
"kind": "method",
99+
"kindModifiers": "",
100+
"sortText": "indexOf"
101+
},
102+
{
103+
"name": "italics",
104+
"kind": "method",
105+
"kindModifiers": "",
106+
"sortText": "italics"
107+
},
108+
{
109+
"name": "lastIndexOf",
110+
"kind": "method",
111+
"kindModifiers": "",
112+
"sortText": "lastIndexOf"
113+
},
114+
{
115+
"name": "length",
116+
"kind": "property",
117+
"kindModifiers": "",
118+
"sortText": "length"
119+
},
120+
{
121+
"name": "link",
122+
"kind": "method",
123+
"kindModifiers": "",
124+
"sortText": "link"
125+
},
126+
{
127+
"name": "localeCompare",
128+
"kind": "method",
129+
"kindModifiers": "",
130+
"sortText": "localeCompare"
131+
},
132+
{
133+
"name": "match",
134+
"kind": "method",
135+
"kindModifiers": "",
136+
"sortText": "match"
137+
},
138+
{
139+
"name": "normalize",
140+
"kind": "method",
141+
"kindModifiers": "",
142+
"sortText": "normalize"
143+
},
144+
{
145+
"name": "repeat",
146+
"kind": "method",
147+
"kindModifiers": "",
148+
"sortText": "repeat"
149+
},
150+
{
151+
"name": "replace",
152+
"kind": "method",
153+
"kindModifiers": "",
154+
"sortText": "replace"
155+
},
156+
{
157+
"name": "search",
158+
"kind": "method",
159+
"kindModifiers": "",
160+
"sortText": "search"
161+
},
162+
{
163+
"name": "slice",
164+
"kind": "method",
165+
"kindModifiers": "",
166+
"sortText": "slice"
167+
},
168+
{
169+
"name": "small",
170+
"kind": "method",
171+
"kindModifiers": "",
172+
"sortText": "small"
173+
},
174+
{
175+
"name": "split",
176+
"kind": "method",
177+
"kindModifiers": "",
178+
"sortText": "split"
179+
},
180+
{
181+
"name": "startsWith",
182+
"kind": "method",
183+
"kindModifiers": "",
184+
"sortText": "startsWith"
185+
},
186+
{
187+
"name": "strike",
188+
"kind": "method",
189+
"kindModifiers": "",
190+
"sortText": "strike"
191+
},
192+
{
193+
"name": "sub",
194+
"kind": "method",
195+
"kindModifiers": "",
196+
"sortText": "sub"
197+
},
198+
{
199+
"name": "substr",
200+
"kind": "method",
201+
"kindModifiers": "",
202+
"sortText": "substr"
203+
},
204+
{
205+
"name": "substring",
206+
"kind": "method",
207+
"kindModifiers": "",
208+
"sortText": "substring"
209+
},
210+
{
211+
"name": "sup",
212+
"kind": "method",
213+
"kindModifiers": "",
214+
"sortText": "sup"
215+
},
216+
{
217+
"name": "toLocaleLowerCase",
218+
"kind": "method",
219+
"kindModifiers": "",
220+
"sortText": "toLocaleLowerCase"
221+
},
222+
{
223+
"name": "toLocaleUpperCase",
224+
"kind": "method",
225+
"kindModifiers": "",
226+
"sortText": "toLocaleUpperCase"
227+
},
228+
{
229+
"name": "toLowerCase",
230+
"kind": "method",
231+
"kindModifiers": "",
232+
"sortText": "toLowerCase"
233+
},
234+
{
235+
"name": "toString",
236+
"kind": "method",
237+
"kindModifiers": "",
238+
"sortText": "toString"
239+
},
240+
{
241+
"name": "toUpperCase",
242+
"kind": "method",
243+
"kindModifiers": "",
244+
"sortText": "toUpperCase"
245+
},
246+
{
247+
"name": "trim",
248+
"kind": "method",
249+
"kindModifiers": "",
250+
"sortText": "trim"
251+
},
252+
{
253+
"name": "valueOf",
254+
"kind": "method",
255+
"kindModifiers": "",
256+
"sortText": "valueOf"
257+
}
258+
]
259+
}
260+
]
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[
2+
{
3+
"seq": 0,
4+
"type": "request",
5+
"command": "configure",
6+
"arguments": {
7+
"hostInfo": "vscode"
8+
}
9+
},
10+
{
11+
"seq": 1,
12+
"type": "request",
13+
"command": "compilerOptionsForInferredProjects",
14+
"arguments": {
15+
"options": {
16+
"module": "CommonJS",
17+
"target": "ES6",
18+
"allowSyntheticDefaultImports": true,
19+
"allowNonTsExtensions": true,
20+
"allowJs": true,
21+
"jsx": "Preserve"
22+
}
23+
}
24+
},
25+
{
26+
"seq": 4,
27+
"type": "request",
28+
"command": "open",
29+
"arguments": {
30+
"file": "$$PWD$$/project/app/app.component.ts",
31+
"fileContent": "import { Component } from '@angular/core';\n\n@Component({\n selector: 'my-app',\n template: `<h1>Hello {{name}}</h1>`,\n})\nexport class AppComponent { name = 'Angular'; }\n"
32+
}
33+
},
34+
{
35+
"seq": 7,
36+
"type": "request",
37+
"command": "geterr",
38+
"arguments": {
39+
"delay": 0,
40+
"files": [
41+
"$$PWD$$/project/app/app.component.ts"
42+
]
43+
}
44+
},
45+
{
46+
"seq": 12,
47+
"type": "request",
48+
"command": "change",
49+
"arguments": {
50+
"file": "$$PWD$$/project/app/app.component.ts",
51+
"line": 5,
52+
"offset": 30,
53+
"endLine": 5,
54+
"endOffset": 30,
55+
"insertString": "."
56+
}
57+
},
58+
{
59+
"seq": 13,
60+
"type": "request",
61+
"command": "completions",
62+
"arguments": {
63+
"file": "$$PWD$$/project/app/app.component.ts",
64+
"line": 5,
65+
"offset": 31
66+
}
67+
}
68+
]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"type": "response",
4+
"command": "configure",
5+
"success": true
6+
},
7+
{
8+
"type": "response",
9+
"command": "compilerOptionsForInferredProjects",
10+
"success": true,
11+
"body": true
12+
}
13+
]

0 commit comments

Comments
 (0)