mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Test to verify that file with --out and case mismatch works with source map
This commit is contained in:
@@ -10481,13 +10481,15 @@ declare class TestLib {
|
||||
TestFSWithWatch.getTsBuildProjectFile(project, "index.ts"),
|
||||
];
|
||||
}
|
||||
it("does not error on container only project", () => {
|
||||
const project = "container";
|
||||
const containerLib = getProjectFiles("container/lib");
|
||||
const containerExec = getProjectFiles("container/exec");
|
||||
const containerCompositeExec = getProjectFiles("container/compositeExec");
|
||||
const containerConfig = TestFSWithWatch.getTsBuildProjectFile(project, "tsconfig.json");
|
||||
const files = [libFile, ...containerLib, ...containerExec, ...containerCompositeExec, containerConfig];
|
||||
|
||||
const project = "container";
|
||||
const containerLib = getProjectFiles("container/lib");
|
||||
const containerExec = getProjectFiles("container/exec");
|
||||
const containerCompositeExec = getProjectFiles("container/compositeExec");
|
||||
const containerConfig = TestFSWithWatch.getTsBuildProjectFile(project, "tsconfig.json");
|
||||
const files = [libFile, ...containerLib, ...containerExec, ...containerCompositeExec, containerConfig];
|
||||
|
||||
function createHost() {
|
||||
const host = createServerHost(files);
|
||||
|
||||
// ts build should succeed
|
||||
@@ -10495,6 +10497,12 @@ declare class TestLib {
|
||||
solutionBuilder.buildAllProjects();
|
||||
assert.equal(host.getOutput().length, 0);
|
||||
|
||||
return host;
|
||||
}
|
||||
|
||||
it("does not error on container only project", () => {
|
||||
const host = createHost();
|
||||
|
||||
// Open external project for the folder
|
||||
const session = createSession(host);
|
||||
const service = session.getProjectService();
|
||||
@@ -10521,6 +10529,30 @@ declare class TestLib {
|
||||
assert.deepEqual(semanticDiagnostics, []);
|
||||
});
|
||||
});
|
||||
|
||||
it("can successfully find references with --out options", () => {
|
||||
const host = createHost();
|
||||
const session = createSession(host);
|
||||
openFilesForSession([containerCompositeExec[1]], session);
|
||||
const service = session.getProjectService();
|
||||
checkNumberOfProjects(service, { configuredProjects: 1 });
|
||||
const locationOfMyConst = protocolLocationFromSubstring(containerCompositeExec[1].content, "myConst");
|
||||
const response = session.executeCommandSeq<protocol.RenameRequest>({
|
||||
command: protocol.CommandTypes.Rename,
|
||||
arguments: {
|
||||
file: containerCompositeExec[1].path,
|
||||
...locationOfMyConst
|
||||
}
|
||||
}).response as protocol.RenameResponseBody;
|
||||
|
||||
|
||||
const myConstLen = "myConst".length;
|
||||
const locationOfMyConstInLib = protocolLocationFromSubstring(containerLib[1].content, "myConst");
|
||||
assert.deepEqual(response.locs, [
|
||||
{ file: containerCompositeExec[1].path, locs: [{ start: locationOfMyConst, end: { line: locationOfMyConst.line, offset: locationOfMyConst.offset + myConstLen } }] },
|
||||
{ file: containerLib[1].path, locs: [{ start: locationOfMyConstInLib, end: { line: locationOfMyConstInLib.line, offset: locationOfMyConstInLib.offset + myConstLen } }] }
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserverProjectSystem duplicate packages", () => {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outFile": "../built/local/compositeExec.js",
|
||||
"composite": true
|
||||
"composite": true,
|
||||
"declarationMap": true
|
||||
},
|
||||
"files": [
|
||||
"index.ts"
|
||||
|
||||
Reference in New Issue
Block a user