Skip to content

Commit d4e4b43

Browse files
committed
Verify that own config change in module resolution gets reflected
1 parent 4d413a6 commit d4e4b43

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

src/testRunner/unittests/tsbuildWatchMode.ts

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -542,19 +542,13 @@ export function gfoo() {
542542
return expectedFiles.map(file => [file, host.getModifiedTime(file)] as OutputFileStamp);
543543
}
544544

545-
function verifyWatches(host: WatchedSystem) {
546-
verifyWatchesOfProject(host, expectedWatchedFiles, expectedWatchedDirectoriesRecursive);
547-
}
548-
549545
function verifyProgram(host: WatchedSystem, watch: () => BuilderProgram) {
550-
verifyWatches(host);
551-
546+
verifyWatchesOfProject(host, expectedWatchedFiles, expectedWatchedDirectoriesRecursive);
547+
checkProgramActualFiles(watch().getProgram(), expectedProgramFiles);
552548
verifyDependencies(watch, aDts, [aDts]);
553-
verifyDependencies(watch, refs.path, [refs.path]);
554549
verifyDependencies(watch, bDts, [bDts, aDts]);
550+
verifyDependencies(watch, refs.path, [refs.path]);
555551
verifyDependencies(watch, cTs.path, [cTs.path, refs.path, bDts]);
556-
557-
checkProgramActualFiles(watch().getProgram(), expectedProgramFiles);
558552
}
559553

560554
it("verifies dependencies and watches", () => {
@@ -577,6 +571,30 @@ export function gfoo() {
577571
checkOutputErrorsIncremental(host, emptyArray);
578572
verifyProgram(host, watch);
579573
});
574+
575+
it("edit on config file", () => {
576+
const { host, watch } = createSolutionAndWatchMode();
577+
578+
const nrefs: File = {
579+
path: getFilePathInProject(project, "nrefs/a.d.ts"),
580+
content: refs.content
581+
};
582+
const cTsConfigJson = JSON.parse(cTsconfig.content);
583+
host.ensureFileOrFolder(nrefs);
584+
cTsConfigJson.compilerOptions.paths = { "@ref/*": ["./nrefs/*"] };
585+
host.writeFile(cTsconfig.path, JSON.stringify(cTsConfigJson));
586+
587+
host.checkTimeoutQueueLengthAndRun(1);
588+
checkOutputErrorsIncremental(host, emptyArray);
589+
590+
const nrefReplacer = (f: string) => f.replace("refs", "nrefs");
591+
verifyWatchesOfProject(host, expectedWatchedFiles.map(nrefReplacer), expectedWatchedDirectoriesRecursive.map(nrefReplacer));
592+
checkProgramActualFiles(watch().getProgram(), expectedProgramFiles.map(nrefReplacer));
593+
verifyDependencies(watch, aDts, [aDts]);
594+
verifyDependencies(watch, bDts, [bDts, aDts]);
595+
verifyDependencies(watch, nrefs.path, [nrefs.path]);
596+
verifyDependencies(watch, cTs.path, [cTs.path, nrefs.path, bDts]);
597+
});
580598
});
581599
});
582600
});

0 commit comments

Comments
 (0)