@@ -256,5 +256,75 @@ namespace ts.tscWatch {
256
256
] ,
257
257
} ) ;
258
258
} ) ;
259
+
260
+ verifyTscWatch ( {
261
+ scenario : "moduleResolution" ,
262
+ subScenario : "module resolutions from file are partially used" ,
263
+ sys : ( ) => createWatchedSystem ( [
264
+ {
265
+ path : `${ projectRoot } /tsconfig.json` ,
266
+ content : JSON . stringify ( {
267
+ compilerOptions : { moduleResolution : "node16" } ,
268
+ } )
269
+ } ,
270
+ {
271
+ path : `${ projectRoot } /index.ts` ,
272
+ content : Utils . dedent `
273
+ import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
274
+ import type { RequireInterface } from "pkg1" assert { "resolution-mode": "require" };
275
+ import {x} from "./a";
276
+ `
277
+ } ,
278
+ {
279
+ path : `${ projectRoot } /a.ts` ,
280
+ content : Utils . dedent `
281
+ export const x = 10;
282
+ `
283
+ } ,
284
+ {
285
+ path : `${ projectRoot } /node_modules/pkg/package.json` ,
286
+ content : JSON . stringify ( {
287
+ name : "pkg" ,
288
+ version : "0.0.1" ,
289
+ exports : {
290
+ import : "./import.js" ,
291
+ require : "./require.js"
292
+ }
293
+ } )
294
+ } ,
295
+ {
296
+ path : `${ projectRoot } /node_modules/pkg/import.d.ts` ,
297
+ content : `export interface ImportInterface {}`
298
+ } ,
299
+ {
300
+ path : `${ projectRoot } /node_modules/pkg/require.d.ts` ,
301
+ content : `export interface RequireInterface {}`
302
+ } ,
303
+ {
304
+ path : `${ projectRoot } /node_modules/pkg1/package.json` ,
305
+ content : JSON . stringify ( {
306
+ name : "pkg1" ,
307
+ version : "0.0.1" ,
308
+ exports : {
309
+ import : "./import.js" ,
310
+ require : "./require.js"
311
+ }
312
+ } )
313
+ } ,
314
+ {
315
+ path : `${ projectRoot } /node_modules/pkg1/import.d.ts` ,
316
+ content : `export interface ImportInterface {}`
317
+ } ,
318
+ libFile
319
+ ] , { currentDirectory : projectRoot } ) ,
320
+ commandLineArgs : [ "-w" , "--traceResolution" ] ,
321
+ changes : [
322
+ {
323
+ caption : "modify aFile by adding import" ,
324
+ change : sys => sys . appendFile ( `${ projectRoot } /a.ts` , `import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }` ) ,
325
+ timeouts : sys => sys . runQueuedTimeoutCallbacks ( ) ,
326
+ }
327
+ ]
328
+ } ) ;
259
329
} ) ;
260
330
}
0 commit comments