mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-13 11:46:08 -05:00
Delay the calculation of common source root if it would be needed when calculation dts files (#59070)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as ts from "../../_namespaces/ts.js";
|
||||
import { jsonToReadableText } from "../helpers.js";
|
||||
import { libContent } from "../helpers/contents.js";
|
||||
import {
|
||||
baselineTsserverLogs,
|
||||
closeFilesForSession,
|
||||
@@ -833,3 +834,29 @@ describe("unittests:: tsserver:: projectErrors:: with file rename on wsl2::", ()
|
||||
baselineTsserverLogs("projectErrors", "file rename on wsl2", session);
|
||||
});
|
||||
});
|
||||
|
||||
describe("unittests:: tsserver:: projectErrors:: dts errors when files dont belong to common root", () => {
|
||||
[undefined, "decls"].forEach(declarationDir => {
|
||||
it(`dts errors when files dont belong to common root${declarationDir ? " with declarationDir" : ""}`, () => {
|
||||
const host = createServerHost({
|
||||
"/home/src/projects/project/src/file.ts": `import { a } from "../a";`,
|
||||
"/home/src/projects/project/a.ts": `export const a = 10;`,
|
||||
"/home/src/projects/project/src/tsconfig.json": jsonToReadableText({
|
||||
compilerOptions: {
|
||||
composite: true,
|
||||
noEmit: true,
|
||||
declarationDir,
|
||||
},
|
||||
}),
|
||||
[libFile.path]: libContent,
|
||||
});
|
||||
const session = new TestSession(host);
|
||||
openFilesForSession(["/home/src/projects/project/src/file.ts"], session);
|
||||
verifyGetErrRequest({
|
||||
session,
|
||||
files: ["/home/src/projects/project/src/file.ts"],
|
||||
});
|
||||
baselineTsserverLogs("projectErrors", `dts errors when files dont belong to common root${declarationDir ? " with declarationDir" : ""}`, session);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user