forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(language-service): test
@angular/language-service
can be loade…
…d by tsserver.js (angular#14721)
- Loading branch information
1 parent
30554a9
commit fa0e6a0
Showing
21 changed files
with
833 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Angular Language Service Test | ||
|
||
This directory is an integration test for `@angular/language-service` to ensure | ||
that various versions of the server can be loaded in the supported versions of | ||
TypeScript's language service. | ||
|
||
## New supported version of TypeScript | ||
|
||
To add a new supported version of TypeScript: | ||
|
||
1) Create directory in `typescripts` to hold the new version following the pattern | ||
of the other versions. | ||
2) Add the directory name to the end of the `TYPESCRIPTS` variable in the | ||
`scripts/env.sh` file. | ||
3) Run `scripts/update_golden.sh` to generate the expected files. | ||
4) Verify the expected output is reasonable by comparing to a known good output | ||
from a previous version. | ||
|
||
## Update golden files | ||
|
||
If the expected output needs to be updated run `scripts/update_golden.sh` to | ||
update the expected output of the server. | ||
|
||
## Adding a new fixture | ||
|
||
Currently there is no automated way to produce a new fixture. The way the | ||
current fixtures were created was to hack a version of tsserver.js to write the | ||
commands from `VSCode` to a file while performing the operation to be tested. | ||
I also hand modified the input to remove superfluous request. | ||
|
||
Once a new fixture is created: | ||
|
||
1) Add the fixture base name (without the .json) to `FIXTURES` in | ||
`scripts/env.sh`. | ||
2) Run `scripts/udpate_golden.sh` to produce the expected output files. | ||
3) Hand validate the expected output is reasonable. |
260 changes: 260 additions & 0 deletions
260
integration/language_service_plugin/fixtures/getCompletions-expected-2.3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,260 @@ | ||
[ | ||
{ | ||
"type": "response", | ||
"command": "configure", | ||
"success": true | ||
}, | ||
{ | ||
"type": "response", | ||
"command": "compilerOptionsForInferredProjects", | ||
"success": true, | ||
"body": true | ||
}, | ||
{ | ||
"type": "response", | ||
"command": "completions", | ||
"success": true, | ||
"body": [ | ||
{ | ||
"name": "anchor", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "anchor" | ||
}, | ||
{ | ||
"name": "big", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "big" | ||
}, | ||
{ | ||
"name": "blink", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "blink" | ||
}, | ||
{ | ||
"name": "bold", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "bold" | ||
}, | ||
{ | ||
"name": "charAt", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "charAt" | ||
}, | ||
{ | ||
"name": "charCodeAt", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "charCodeAt" | ||
}, | ||
{ | ||
"name": "codePointAt", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "codePointAt" | ||
}, | ||
{ | ||
"name": "concat", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "concat" | ||
}, | ||
{ | ||
"name": "endsWith", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "endsWith" | ||
}, | ||
{ | ||
"name": "fixed", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "fixed" | ||
}, | ||
{ | ||
"name": "fontcolor", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "fontcolor" | ||
}, | ||
{ | ||
"name": "fontsize", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "fontsize" | ||
}, | ||
{ | ||
"name": "includes", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "includes" | ||
}, | ||
{ | ||
"name": "indexOf", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "indexOf" | ||
}, | ||
{ | ||
"name": "italics", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "italics" | ||
}, | ||
{ | ||
"name": "lastIndexOf", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "lastIndexOf" | ||
}, | ||
{ | ||
"name": "length", | ||
"kind": "property", | ||
"kindModifiers": "", | ||
"sortText": "length" | ||
}, | ||
{ | ||
"name": "link", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "link" | ||
}, | ||
{ | ||
"name": "localeCompare", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "localeCompare" | ||
}, | ||
{ | ||
"name": "match", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "match" | ||
}, | ||
{ | ||
"name": "normalize", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "normalize" | ||
}, | ||
{ | ||
"name": "repeat", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "repeat" | ||
}, | ||
{ | ||
"name": "replace", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "replace" | ||
}, | ||
{ | ||
"name": "search", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "search" | ||
}, | ||
{ | ||
"name": "slice", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "slice" | ||
}, | ||
{ | ||
"name": "small", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "small" | ||
}, | ||
{ | ||
"name": "split", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "split" | ||
}, | ||
{ | ||
"name": "startsWith", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "startsWith" | ||
}, | ||
{ | ||
"name": "strike", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "strike" | ||
}, | ||
{ | ||
"name": "sub", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "sub" | ||
}, | ||
{ | ||
"name": "substr", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "substr" | ||
}, | ||
{ | ||
"name": "substring", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "substring" | ||
}, | ||
{ | ||
"name": "sup", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "sup" | ||
}, | ||
{ | ||
"name": "toLocaleLowerCase", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "toLocaleLowerCase" | ||
}, | ||
{ | ||
"name": "toLocaleUpperCase", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "toLocaleUpperCase" | ||
}, | ||
{ | ||
"name": "toLowerCase", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "toLowerCase" | ||
}, | ||
{ | ||
"name": "toString", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "toString" | ||
}, | ||
{ | ||
"name": "toUpperCase", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "toUpperCase" | ||
}, | ||
{ | ||
"name": "trim", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "trim" | ||
}, | ||
{ | ||
"name": "valueOf", | ||
"kind": "method", | ||
"kindModifiers": "", | ||
"sortText": "valueOf" | ||
} | ||
] | ||
} | ||
] |
68 changes: 68 additions & 0 deletions
68
integration/language_service_plugin/fixtures/getCompletions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
[ | ||
{ | ||
"seq": 0, | ||
"type": "request", | ||
"command": "configure", | ||
"arguments": { | ||
"hostInfo": "vscode" | ||
} | ||
}, | ||
{ | ||
"seq": 1, | ||
"type": "request", | ||
"command": "compilerOptionsForInferredProjects", | ||
"arguments": { | ||
"options": { | ||
"module": "CommonJS", | ||
"target": "ES6", | ||
"allowSyntheticDefaultImports": true, | ||
"allowNonTsExtensions": true, | ||
"allowJs": true, | ||
"jsx": "Preserve" | ||
} | ||
} | ||
}, | ||
{ | ||
"seq": 4, | ||
"type": "request", | ||
"command": "open", | ||
"arguments": { | ||
"file": "$$PWD$$/project/app/app.component.ts", | ||
"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" | ||
} | ||
}, | ||
{ | ||
"seq": 7, | ||
"type": "request", | ||
"command": "geterr", | ||
"arguments": { | ||
"delay": 0, | ||
"files": [ | ||
"$$PWD$$/project/app/app.component.ts" | ||
] | ||
} | ||
}, | ||
{ | ||
"seq": 12, | ||
"type": "request", | ||
"command": "change", | ||
"arguments": { | ||
"file": "$$PWD$$/project/app/app.component.ts", | ||
"line": 5, | ||
"offset": 30, | ||
"endLine": 5, | ||
"endOffset": 30, | ||
"insertString": "." | ||
} | ||
}, | ||
{ | ||
"seq": 13, | ||
"type": "request", | ||
"command": "completions", | ||
"arguments": { | ||
"file": "$$PWD$$/project/app/app.component.ts", | ||
"line": 5, | ||
"offset": 31 | ||
} | ||
} | ||
] |
13 changes: 13 additions & 0 deletions
13
integration/language_service_plugin/fixtures/smokeTest-expected-2.3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[ | ||
{ | ||
"type": "response", | ||
"command": "configure", | ||
"success": true | ||
}, | ||
{ | ||
"type": "response", | ||
"command": "compilerOptionsForInferredProjects", | ||
"success": true, | ||
"body": true | ||
} | ||
] |
Oops, something went wrong.