@@ -7,13 +7,17 @@ namespace ts.tscWatch {
7
7
content : Utils . dedent `
8
8
import { something } from "./filePresent";
9
9
import { something as something1 } from "./filePresent";
10
- import { something2 } from "./fileNotFound";` ,
10
+ import { something2 } from "./fileNotFound";
11
+ import { externalThing1 } from "externalThing";
12
+ import { externalThing2 } from "externalThingNotPresent";` ,
11
13
} ,
12
14
{
13
15
path : `${ projectRoot } /src/anotherFileReusingResolution.ts` ,
14
16
content : Utils . dedent `
15
17
import { something } from "./filePresent";
16
- import { something2 } from "./fileNotFound";` ,
18
+ import { something2 } from "./fileNotFound";
19
+ import { externalThing1 } from "externalThing";
20
+ import { externalThing2 } from "externalThingNotPresent";` ,
17
21
} ,
18
22
{
19
23
path : `${ projectRoot } /src/filePresent.ts` ,
@@ -47,6 +51,10 @@ namespace ts.tscWatch {
47
51
path : `${ projectRoot } /src/globalFilePresent.ts` ,
48
52
content : `function globalSomething() { return 10; }` ,
49
53
} ,
54
+ {
55
+ path : `${ projectRoot } /src/externalThing.d.ts` ,
56
+ content : `export function externalThing1(): number;` ,
57
+ } ,
50
58
{
51
59
path : `${ projectRoot } /tsconfig.json` ,
52
60
content : JSON . stringify ( {
@@ -142,6 +150,22 @@ namespace ts.tscWatch {
142
150
sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
143
151
}
144
152
} ,
153
+ {
154
+ caption : "Create external module file that could not be resolved" ,
155
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThingNotPresent.ts` , "export function externalThing2() { return 20; }" ) ,
156
+ timeouts : sys => {
157
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
158
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
159
+ }
160
+ } ,
161
+ {
162
+ caption : "Write .ts file that takes preference over resolved .d.ts file" ,
163
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThing.ts` , "export function externalThing1() { return 10; }" ) ,
164
+ timeouts : sys => {
165
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
166
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
167
+ }
168
+ } ,
145
169
]
146
170
} ) ;
147
171
verifyTscWatch ( {
@@ -199,6 +223,22 @@ namespace ts.tscWatch {
199
223
sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
200
224
}
201
225
} ,
226
+ {
227
+ caption : "Create external module file that could not be resolved" ,
228
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThingNotPresent.ts` , "export function externalThing2() { return 20; }" ) ,
229
+ timeouts : sys => {
230
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
231
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
232
+ }
233
+ } ,
234
+ {
235
+ caption : "Write .ts file that takes preference over resolved .d.ts file" ,
236
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThing.ts` , "export function externalThing1() { return 10; }" ) ,
237
+ timeouts : sys => {
238
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
239
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
240
+ }
241
+ } ,
202
242
]
203
243
} ) ;
204
244
verifyTscWatch ( {
@@ -256,6 +296,22 @@ namespace ts.tscWatch {
256
296
sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
257
297
}
258
298
} ,
299
+ {
300
+ caption : "Create external module file that could not be resolved" ,
301
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThingNotPresent.ts` , "export function externalThing2() { return 20; }" ) ,
302
+ timeouts : sys => {
303
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
304
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
305
+ }
306
+ } ,
307
+ {
308
+ caption : "Write .ts file that takes preference over resolved .d.ts file" ,
309
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThing.ts` , "export function externalThing1() { return 10; }" ) ,
310
+ timeouts : sys => {
311
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
312
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
313
+ }
314
+ } ,
259
315
]
260
316
} ) ;
261
317
@@ -314,6 +370,22 @@ namespace ts.tscWatch {
314
370
sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
315
371
}
316
372
} ,
373
+ {
374
+ caption : "Create external module file that could not be resolved" ,
375
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThingNotPresent.ts` , "export function externalThing2() { return 20; }" ) ,
376
+ timeouts : sys => {
377
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
378
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
379
+ }
380
+ } ,
381
+ {
382
+ caption : "Write .ts file that takes preference over resolved .d.ts file" ,
383
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThing.ts` , "export function externalThing1() { return 10; }" ) ,
384
+ timeouts : sys => {
385
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
386
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
387
+ }
388
+ } ,
317
389
]
318
390
} ) ;
319
391
verifyTscWatch ( {
@@ -371,6 +443,22 @@ namespace ts.tscWatch {
371
443
sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
372
444
}
373
445
} ,
446
+ {
447
+ caption : "Create external module file that could not be resolved" ,
448
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThingNotPresent.ts` , "export function externalThing2() { return 20; }" ) ,
449
+ timeouts : sys => {
450
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
451
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
452
+ }
453
+ } ,
454
+ {
455
+ caption : "Write .ts file that takes preference over resolved .d.ts file" ,
456
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThing.ts` , "export function externalThing1() { return 10; }" ) ,
457
+ timeouts : sys => {
458
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
459
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
460
+ }
461
+ } ,
374
462
]
375
463
} ) ;
376
464
verifyTscWatch ( {
@@ -428,6 +516,22 @@ namespace ts.tscWatch {
428
516
sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
429
517
}
430
518
} ,
519
+ {
520
+ caption : "Create external module file that could not be resolved" ,
521
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThingNotPresent.ts` , "export function externalThing2() { return 20; }" ) ,
522
+ timeouts : sys => {
523
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
524
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
525
+ }
526
+ } ,
527
+ {
528
+ caption : "Write .ts file that takes preference over resolved .d.ts file" ,
529
+ change : sys => sys . writeFile ( `${ projectRoot } /src/externalThing.ts` , "export function externalThing1() { return 10; }" ) ,
530
+ timeouts : sys => {
531
+ sys . runQueuedTimeoutCallbacks ( ) ; // Invalidate resolutions
532
+ sys . runQueuedTimeoutCallbacks ( ) ; // Actual update
533
+ }
534
+ } ,
431
535
]
432
536
} ) ;
433
537
} ) ;
0 commit comments