Skip to content

Commit 5ef80a9

Browse files
committed
Add test when repeated goToSource shouldnt change the project
1 parent 0efe4ee commit 5ef80a9

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

src/testRunner/unittests/tsserver/auxiliaryProject.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ describe("unittests:: tsserver:: auxiliaryProject::", () => {
115115
command: ts.server.protocol.CommandTypes.FindSourceDefinition,
116116
arguments: protocolFileLocationFromSubstring(indexFile, "positional"),
117117
});
118+
session.executeCommandSeq<ts.server.protocol.FindSourceDefinitionRequest>({
119+
command: ts.server.protocol.CommandTypes.FindSourceDefinition,
120+
arguments: protocolFileLocationFromSubstring(indexFile, "positional"),
121+
});
118122
baselineTsserverLogs("auxiliaryProject", "file is added later through finding definition", session);
119123
});
120124
});

tests/baselines/reference/tsserver/auxiliaryProject/file-is-added-later-through-finding-definition.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,75 @@ FsWatchesRecursive::
235235
{}
236236
/user/users/projects/myproject/node_modules/@types:
237237
{}
238+
239+
Before request
240+
241+
Info seq [hh:mm:ss:mss] request:
242+
{
243+
"command": "findSourceDefinition",
244+
"arguments": {
245+
"file": "/user/users/projects/myproject/index.ts",
246+
"line": 3,
247+
"offset": 11
248+
},
249+
"seq": 3,
250+
"type": "request"
251+
}
252+
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/auxiliaryProject1*
253+
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/auxiliaryProject1* Version: 3 structureChanged: true structureIsReused:: Not Elapsed:: *ms
254+
Info seq [hh:mm:ss:mss] Project '/dev/null/auxiliaryProject1*' (Auxiliary)
255+
Info seq [hh:mm:ss:mss] Files (2)
256+
/user/users/projects/myproject/node_modules/yargs/index.js Text-1 "// Specifically didnt have ./callback import to ensure that resolving module sepcifier adds the file to project at later stage\nexport function command(cmd, cb) { cb(Yargs) }\n"
257+
/user/users/projects/myproject/index.ts SVC-1-0 "import { command } from \"yargs\";\ncommand(\"foo\", yargs => {\n yargs.positional();\n});\n"
258+
259+
260+
node_modules/yargs/index.js
261+
Imported via "yargs" from file 'index.ts' with packageId 'yargs/index.js@1.0.0'
262+
index.ts
263+
Root file specified for compilation
264+
265+
Info seq [hh:mm:ss:mss] -----------------------------------------------
266+
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/auxiliaryProject1*
267+
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/auxiliaryProject1* Version: 4 structureChanged: true structureIsReused:: Not Elapsed:: *ms
268+
Info seq [hh:mm:ss:mss] Project '/dev/null/auxiliaryProject1*' (Auxiliary)
269+
Info seq [hh:mm:ss:mss] Files (3)
270+
/user/users/projects/myproject/node_modules/yargs/index.js Text-1 "// Specifically didnt have ./callback import to ensure that resolving module sepcifier adds the file to project at later stage\nexport function command(cmd, cb) { cb(Yargs) }\n"
271+
/user/users/projects/myproject/index.ts SVC-1-0 "import { command } from \"yargs\";\ncommand(\"foo\", yargs => {\n yargs.positional();\n});\n"
272+
/user/users/projects/myproject/node_modules/yargs/callback.js Text-1 "export class Yargs { positional() { } }\n"
273+
274+
275+
node_modules/yargs/index.js
276+
Imported via "yargs" from file 'index.ts' with packageId 'yargs/index.js@1.0.0'
277+
index.ts
278+
Root file specified for compilation
279+
node_modules/yargs/callback.js
280+
Root file specified for compilation
281+
282+
Info seq [hh:mm:ss:mss] -----------------------------------------------
283+
Info seq [hh:mm:ss:mss] response:
284+
{
285+
"response": [
286+
{
287+
"file": "/user/users/projects/myproject/node_modules/yargs/callback.js",
288+
"start": {
289+
"line": 1,
290+
"offset": 22
291+
},
292+
"end": {
293+
"line": 1,
294+
"offset": 32
295+
},
296+
"contextStart": {
297+
"line": 1,
298+
"offset": 22
299+
},
300+
"contextEnd": {
301+
"line": 1,
302+
"offset": 38
303+
},
304+
"unverified": true
305+
}
306+
],
307+
"responseRequired": true
308+
}
309+
After request

0 commit comments

Comments
 (0)