fix(language-service): Fix crash when no script files are found (#20550)

Fixes the crash in typescript host when getScriptFileNames() returns an
empty array.

PR Close #19325

PR Close #20550
This commit is contained in:
Keen Yee Liau
2017-11-20 16:31:07 -08:00
committed by Miško Hevery
parent ba850b36de
commit 54bfe14313
2 changed files with 25 additions and 6 deletions

View File

@ -39,4 +39,11 @@ describe('completions', () => {
ngHost = new TypeScriptServiceHost(host, service);
expect(ngHost.getAnalyzedModules()).toBeDefined();
});
it('should not throw if there is no script names', () => {
host = new MockTypescriptHost([], toh);
service = ts.createLanguageService(host);
ngHost = new TypeScriptServiceHost(host, service);
expect(() => ngHost.getAnalyzedModules()).not.toThrow();
});
});