test(language-service): Move completions test to completions_spec.ts (#33159)

There are many specs in `ts_plugin_spec.ts` that exercise the behavior
of completions. These specs should belong in `completions_spec` instead.

In addition,

1. Tests for `getExternalFiles()` added in `ts_plugin_spec.ts`
2. Fixed bug in MockHost.reset() to remove overriden script names
3. Add test for TS diagnostics when `angularOnly = true` is not set

PR Close #33159
This commit is contained in:
Keen Yee Liau
2019-10-14 15:24:28 -07:00
committed by Matias Niemelä
parent 51b9ce44ea
commit 67c914819a
4 changed files with 464 additions and 348 deletions

View File

@ -185,6 +185,15 @@ export class MockTypescriptHost implements ts.LanguageServiceHost {
* Reset the project to its original state, effectively removing all overrides.
*/
reset() {
// Remove overrides from scriptNames
let length = 0;
for (let i = 0; i < this.scriptNames.length; ++i) {
const fileName = this.scriptNames[i];
if (!this.overrides.has(fileName)) {
this.scriptNames[length++] = fileName;
}
}
this.scriptNames.splice(length);
this.overrides.clear();
this.overrideDirectory.clear();
this.options = COMPILER_OPTIONS;