fix(compiler): support noResolve (#19301)

PR Close #19301
This commit is contained in:
Tobias Bosch
2017-09-20 16:27:29 -07:00
committed by Igor Minar
parent 04997c8418
commit c76da27240
2 changed files with 62 additions and 16 deletions

View File

@ -208,4 +208,28 @@ describe('ng program', () => {
done();
});
});
it('should work with noResolve', () => {
// create a temporary ts program to get the list of all files from angular...
testSupport.writeFiles({
'src/main.ts': createModuleAndCompSource('main'),
});
const preOptions = testSupport.createCompilerOptions();
const preHost = ts.createCompilerHost(preOptions);
// don't resolve symlinks
preHost.realpath = (f) => f;
const preProgram =
ts.createProgram([path.resolve(testSupport.basePath, 'src/main.ts')], preOptions, preHost);
const allRootNames = preProgram.getSourceFiles().map(sf => sf.fileName);
// now do the actual test with noResolve
const options = testSupport.createCompilerOptions({noResolve: true});
const host = ng.createCompilerHost({options});
const program = ng.createProgram({rootNames: allRootNames, options, host});
expectNoDiagnosticsInProgram(options, program);
program.emit();
testSupport.shouldExist('built/src/main.ngfactory.js');
testSupport.shouldExist('built/src/main.ngfactory.d.ts');
});
});