Skip to content

Commit

Permalink
Add partial semantic test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Feb 1, 2021
1 parent 248ed37 commit f6d3b18
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/testRunner/unittests/tsserver/partialSemanticServer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace ts.projectSystem {
describe("unittests:: tsserver:: Semantic operations on PartialSemantic server", () => {
describe("unittests:: tsserver:: Semantic operations on partialSemanticServer", () => {
function setup() {
const file1: File = {
path: `${tscWatch.projectRoot}/a.ts`,
Expand Down Expand Up @@ -203,5 +203,20 @@ function fooB() { }`
assert.isUndefined(project.getPackageJsonAutoImportProvider());
assert.deepEqual(project.getPackageJsonsForAutoImport(), emptyArray);
});

it("should support go-to-definition on module specifiers", () => {
const { session, file1, file2 } = setup();
openFilesForSession([file1], session);
const response = session.executeCommandSeq<protocol.DefinitionAndBoundSpanRequest>({
command: protocol.CommandTypes.DefinitionAndBoundSpan,
arguments: protocolFileLocationFromSubstring(file1, `"./b"`)
}).response as protocol.DefinitionInfoAndBoundSpan;
assert.isDefined(response);
assert.deepEqual(response.definitions, [{
file: file2.path,
start: { line: 1, offset: 1 },
end: { line: 1, offset: 1 }
}]);
});
});
}

0 comments on commit f6d3b18

Please sign in to comment.