mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Use originalFileName (fileName of input project reference file) to resolve module/typereferences/reference paths in it instead of output decl file path
This also ensures that originalFileName, resolvedPath are set correctly even when we are reusing program structure Fixes #26036
This commit is contained in:
1 parent
b6d90841c9
commit
d51b8d940c
7 files changed
+59
-14
No files matched your search
@@ -23,6 +23,42 @@ namespace ts {
|
||||
assert(fs.existsSync(output), `Expect file ${output} to exist`);
|
||||
}
|
||||
});
|
||||
|
||||
it("builds correctly when outDir is specified", () => {
|
||||
const fs = projFs.shadow();
|
||||
fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, declaration: true, sourceMap: true, outDir: "outDir" },
|
||||
references: [{ path: "../core" }]
|
||||
}));
|
||||
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], {});
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(/*empty*/);
|
||||
const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/", "/logic/outDir/"));
|
||||
// Check for outputs. Not an exhaustive list
|
||||
for (const output of expectedOutputs) {
|
||||
assert(fs.existsSync(output), `Expect file ${output} to exist`);
|
||||
}
|
||||
});
|
||||
|
||||
it("builds correctly when declarationDir is specified", () => {
|
||||
const fs = projFs.shadow();
|
||||
fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, declaration: true, sourceMap: true, declarationDir: "out/decls" },
|
||||
references: [{ path: "../core" }]
|
||||
}));
|
||||
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], {});
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(/*empty*/);
|
||||
const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/index.d.ts", "/logic/out/decls/index.d.ts"));
|
||||
// Check for outputs. Not an exhaustive list
|
||||
for (const output of expectedOutputs) {
|
||||
assert(fs.existsSync(output), `Expect file ${output} to exist`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - dry builds", () => {
|
||||
|
||||
@@ -486,11 +486,7 @@ export function gfoo() {
|
||||
solutionBuilder.buildInvalidatedProject();
|
||||
|
||||
host.checkTimeoutQueueLengthAndRun(1);
|
||||
checkOutputErrorsIncremental(host, [
|
||||
// TODO: #26036
|
||||
// The error is reported in d.ts file because it isnt resolved from ts file path, but is resolved from .d.ts file
|
||||
"sample1/logic/decls/index.d.ts(2,22): error TS2307: Cannot find module '../core/anotherModule'.\n"
|
||||
]);
|
||||
checkOutputErrorsIncremental(host, emptyArray);
|
||||
checkProgramActualFiles(watch().getProgram(), [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, projectFilePath(SubProject.logic, "decls/index.d.ts")]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user