refactor(ngcc): move shared code into DependencyHostBase (#37075)

The various dependency hosts had a lot of duplicated code.
This commit refactors them to move this into the base class.

PR Close #37075
This commit is contained in:
Pete Bacon Darwin
2020-06-04 08:43:04 +01:00
committed by atscott
parent 7f98b87ca0
commit 4d69da57ca
5 changed files with 97 additions and 185 deletions

View File

@ -27,12 +27,12 @@ runInEachFileSystem(() => {
});
describe('collectDependencies()', () => {
it('should not generate a TS AST if the source does not contain any imports or re-exports',
it('should not try to extract import paths if the source does not contain any imports or re-exports',
() => {
spyOn(ts, 'createSourceFile');
const extractImportsSpy = spyOn(host as any, 'extractImports');
host.collectDependencies(
_('/no/imports/or/re-exports/index.js'), createDependencyInfo());
expect(ts.createSourceFile).not.toHaveBeenCalled();
expect(extractImportsSpy).not.toHaveBeenCalled();
});
it('should resolve all the external imports of the source file', () => {