fix(compiler-cli): only use error collector when needed. (#19912)

The error collector changes behavior of the metadata resolver
in ways that haven't been fully hardened. This changes limits
its use to the lazy route detection and the language service.

Issue: #19906

PR Close #19912
This commit is contained in:
Chuck Jazdzewski
2017-10-24 12:52:14 -07:00
committed by Matias Niemelä
parent c92efc15fb
commit 7bfeac746e
6 changed files with 19 additions and 18 deletions

View File

@ -578,8 +578,8 @@ describe('ng program', () => {
});
}
function createProgram(rootNames: string[]) {
const options = testSupport.createCompilerOptions();
function createProgram(rootNames: string[], overrideOptions: ng.CompilerOptions = {}) {
const options = testSupport.createCompilerOptions(overrideOptions);
const host = ng.createCompilerHost({options});
const program = ng.createProgram(
{rootNames: rootNames.map(p => path.resolve(testSupport.basePath, p)), options, host});
@ -821,7 +821,7 @@ describe('ng program', () => {
export class ChildModule {}
`,
});
const program = createProgram(['src/main.ts']).program;
const program = createProgram(['src/main.ts'], {collectAllErrors: true}).program;
expect(normalizeRoutes(program.listLazyRoutes('src/main#MainModule'))).toEqual([{
module: {name: 'MainModule', filePath: path.resolve(testSupport.basePath, 'src/main.ts')},
referencedModule: