Add test case to verify correct resolution file is picked when current resolution file is not removed but higher precedence file is created

This commit is contained in:
Sheetal Nandi
2017-09-08 15:14:03 -07:00
parent 67f9533c67
commit de28d02626
3 changed files with 57 additions and 4 deletions

View File

@@ -825,7 +825,7 @@ namespace ts {
const moduleName = moduleNames[i];
// If we want to reuse resolutions more aggressively, we can refine this to check for whether the
// text of the corresponding modulenames has changed.
if (file === oldSourceFile) {
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
const oldResolvedModule = oldSourceFile && oldSourceFile.resolvedModules.get(moduleName);
if (oldResolvedModule) {
if (isTraceEnabled(options, host)) {
@@ -846,7 +846,7 @@ namespace ts {
trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile);
}
}
else if (!hasInvalidatedResolution(oldProgramState.file.path)) {
else {
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, oldProgramState);
}