Skip to content

Commit 5d658c6

Browse files
committed
Tests with actual persistResolutions
1 parent d604d19 commit 5d658c6

7 files changed

+76
-158
lines changed

src/testRunner/unittests/tsserver/persistResolutions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace ts.projectSystem {
4040
const content = JSON.parse(file.content);
4141
content.compilerOptions = {
4242
...content.compilerOptions || {},
43-
persistResolutions: false,
43+
persistResolutions: true,
4444
traceResolution: true,
4545
};
4646
file.content = JSON.stringify(content, /*replacer*/ undefined, 4);
@@ -317,7 +317,7 @@ namespace ts.projectSystem {
317317
function setupHost() {
318318
const coreConfig: File = {
319319
path: `${tscWatch.projectRoot}/core/tsconfig.json`,
320-
content: JSON.stringify({ compilerOptions: { composite: true, persistResolutions: false, traceResolution: true } })
320+
content: JSON.stringify({ compilerOptions: { composite: true, persistResolutions: true, traceResolution: true } })
321321
};
322322
const coreIndex: File = {
323323
path: `${tscWatch.projectRoot}/core/index.ts`,
@@ -334,7 +334,7 @@ namespace ts.projectSystem {
334334
const logicConfig: File = {
335335
path: `${tscWatch.projectRoot}/logic/tsconfig.json`,
336336
content: JSON.stringify({
337-
compilerOptions: { composite: true, persistResolutions: false, traceResolution: true },
337+
compilerOptions: { composite: true, persistResolutions: true, traceResolution: true },
338338
references: [{ path: "../core" }]
339339
})
340340
};
@@ -354,7 +354,7 @@ export function returnAnotherClass() {
354354
const testsConfig: File = {
355355
path: `${tscWatch.projectRoot}/tests/tsconfig.json`,
356356
content: JSON.stringify({
357-
compilerOptions: { composite: true, persistResolutions: false, traceResolution: true },
357+
compilerOptions: { composite: true, persistResolutions: true, traceResolution: true },
358358
references: [{ path: "../logic" }]
359359
})
360360
};

tests/baselines/reference/tsserver/persistResolutions/creates-new-resolutions-for-program-if-tsbuildinfo-is-not-present-with-project-where-dts-file-contains-fewer-modules-than-original-file.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Config: /user/username/projects/myproject/tests/tsconfig.json : {
1010
],
1111
"options": {
1212
"composite": true,
13-
"persistResolutions": false,
13+
"persistResolutions": true,
1414
"traceResolution": true,
1515
"configFilePath": "/user/username/projects/myproject/tests/tsconfig.json"
1616
},
@@ -31,7 +31,7 @@ Config: /user/username/projects/myproject/logic/tsconfig.json : {
3131
],
3232
"options": {
3333
"composite": true,
34-
"persistResolutions": false,
34+
"persistResolutions": true,
3535
"traceResolution": true,
3636
"configFilePath": "/user/username/projects/myproject/logic/tsconfig.json"
3737
},
@@ -53,7 +53,7 @@ Config: /user/username/projects/myproject/core/tsconfig.json : {
5353
],
5454
"options": {
5555
"composite": true,
56-
"persistResolutions": false,
56+
"persistResolutions": true,
5757
"traceResolution": true,
5858
"configFilePath": "/user/username/projects/myproject/core/tsconfig.json"
5959
}
@@ -70,10 +70,6 @@ File '/user/username/projects/myproject/logic.d.ts' does not exist.
7070
File '/user/username/projects/myproject/logic/package.json' does not exist.
7171
File '/user/username/projects/myproject/logic/index.ts' exist - use it as a name resolution result.
7272
======== Module name '../logic' was successfully resolved to '/user/username/projects/myproject/logic/index.ts'. ========
73-
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 0 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
74-
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 0 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
75-
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/logic 1 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
76-
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/logic 1 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
7773
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/logic/index.ts 500 undefined WatchType: Closed Script info
7874
======== Resolving module '../core/myClass' from '/user/username/projects/myproject/logic/index.ts'. ========
7975
Using compiler options of project reference redirect '/user/username/projects/myproject/logic/tsconfig.json'.
@@ -91,8 +87,6 @@ File '/user/username/projects/myproject/core.d.ts' does not exist.
9187
File '/user/username/projects/myproject/core/package.json' does not exist.
9288
File '/user/username/projects/myproject/core/index.ts' exist - use it as a name resolution result.
9389
======== Module name '../core' was successfully resolved to '/user/username/projects/myproject/core/index.ts'. ========
94-
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/core 1 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
95-
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/core 1 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
9690
======== Resolving module '../core/anotherClass' from '/user/username/projects/myproject/logic/index.ts'. ========
9791
Using compiler options of project reference redirect '/user/username/projects/myproject/logic/tsconfig.json'.
9892
Module resolution kind is not specified, using 'NodeJs'.

tests/baselines/reference/tsserver/persistResolutions/creates-new-resolutions-for-program-if-tsbuildinfo-is-not-present-with-sample-project.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Config: /user/username/projects/sample1/tests/tsconfig.json : {
1313
"declaration": true,
1414
"forceConsistentCasingInFileNames": true,
1515
"skipDefaultLibCheck": true,
16-
"persistResolutions": false,
16+
"persistResolutions": true,
1717
"traceResolution": true,
1818
"configFilePath": "/user/username/projects/sample1/tests/tsconfig.json"
1919
},
@@ -41,7 +41,7 @@ Config: /user/username/projects/sample1/core/tsconfig.json : {
4141
"declaration": true,
4242
"declarationMap": true,
4343
"skipDefaultLibCheck": true,
44-
"persistResolutions": false,
44+
"persistResolutions": true,
4545
"traceResolution": true,
4646
"configFilePath": "/user/username/projects/sample1/core/tsconfig.json"
4747
}
@@ -59,7 +59,7 @@ Config: /user/username/projects/sample1/logic/tsconfig.json : {
5959
"sourceMap": true,
6060
"forceConsistentCasingInFileNames": true,
6161
"skipDefaultLibCheck": true,
62-
"persistResolutions": false,
62+
"persistResolutions": true,
6363
"traceResolution": true,
6464
"configFilePath": "/user/username/projects/sample1/logic/tsconfig.json"
6565
},

tests/baselines/reference/tsserver/persistResolutions/creates-new-resolutions-for-program-if-tsbuildinfo-is-present-but-program-is-not-persisted-with-project-where-dts-file-contains-fewer-modules-than-original-file.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Config: /user/username/projects/myproject/tests/tsconfig.json : {
1010
],
1111
"options": {
1212
"composite": true,
13-
"persistResolutions": false,
13+
"persistResolutions": true,
1414
"traceResolution": true,
1515
"configFilePath": "/user/username/projects/myproject/tests/tsconfig.json"
1616
},
@@ -31,7 +31,7 @@ Config: /user/username/projects/myproject/logic/tsconfig.json : {
3131
],
3232
"options": {
3333
"composite": true,
34-
"persistResolutions": false,
34+
"persistResolutions": true,
3535
"traceResolution": true,
3636
"configFilePath": "/user/username/projects/myproject/logic/tsconfig.json"
3737
},
@@ -53,7 +53,7 @@ Config: /user/username/projects/myproject/core/tsconfig.json : {
5353
],
5454
"options": {
5555
"composite": true,
56-
"persistResolutions": false,
56+
"persistResolutions": true,
5757
"traceResolution": true,
5858
"configFilePath": "/user/username/projects/myproject/core/tsconfig.json"
5959
}
@@ -70,10 +70,6 @@ File '/user/username/projects/myproject/logic.d.ts' does not exist.
7070
File '/user/username/projects/myproject/logic/package.json' does not exist.
7171
File '/user/username/projects/myproject/logic/index.ts' exist - use it as a name resolution result.
7272
======== Module name '../logic' was successfully resolved to '/user/username/projects/myproject/logic/index.ts'. ========
73-
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 0 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
74-
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 0 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
75-
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/logic 1 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
76-
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/logic 1 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
7773
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/logic/index.ts 500 undefined WatchType: Closed Script info
7874
======== Resolving module '../core/myClass' from '/user/username/projects/myproject/logic/index.ts'. ========
7975
Using compiler options of project reference redirect '/user/username/projects/myproject/logic/tsconfig.json'.
@@ -91,8 +87,6 @@ File '/user/username/projects/myproject/core.d.ts' does not exist.
9187
File '/user/username/projects/myproject/core/package.json' does not exist.
9288
File '/user/username/projects/myproject/core/index.ts' exist - use it as a name resolution result.
9389
======== Module name '../core' was successfully resolved to '/user/username/projects/myproject/core/index.ts'. ========
94-
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/core 1 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
95-
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/core 1 undefined Project: /user/username/projects/myproject/tests/tsconfig.json WatchType: Failed Lookup Locations
9690
======== Resolving module '../core/anotherClass' from '/user/username/projects/myproject/logic/index.ts'. ========
9791
Using compiler options of project reference redirect '/user/username/projects/myproject/logic/tsconfig.json'.
9892
Module resolution kind is not specified, using 'NodeJs'.

tests/baselines/reference/tsserver/persistResolutions/creates-new-resolutions-for-program-if-tsbuildinfo-is-present-but-program-is-not-persisted-with-sample-project.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Config: /user/username/projects/sample1/tests/tsconfig.json : {
1313
"declaration": true,
1414
"forceConsistentCasingInFileNames": true,
1515
"skipDefaultLibCheck": true,
16-
"persistResolutions": false,
16+
"persistResolutions": true,
1717
"traceResolution": true,
1818
"configFilePath": "/user/username/projects/sample1/tests/tsconfig.json"
1919
},
@@ -41,7 +41,7 @@ Config: /user/username/projects/sample1/core/tsconfig.json : {
4141
"declaration": true,
4242
"declarationMap": true,
4343
"skipDefaultLibCheck": true,
44-
"persistResolutions": false,
44+
"persistResolutions": true,
4545
"traceResolution": true,
4646
"configFilePath": "/user/username/projects/sample1/core/tsconfig.json"
4747
}
@@ -59,7 +59,7 @@ Config: /user/username/projects/sample1/logic/tsconfig.json : {
5959
"sourceMap": true,
6060
"forceConsistentCasingInFileNames": true,
6161
"skipDefaultLibCheck": true,
62-
"persistResolutions": false,
62+
"persistResolutions": true,
6363
"traceResolution": true,
6464
"configFilePath": "/user/username/projects/sample1/logic/tsconfig.json"
6565
},

0 commit comments

Comments
 (0)