@@ -72,5 +72,75 @@ namespace ts.tscWatch {
7272 } ,
7373 ]
7474 } ) ;
75+
76+ verifyTscWatch ( {
77+ scenario : "moduleResolution" ,
78+ subScenario : "module resolutions from file are partially used" ,
79+ sys : ( ) => createWatchedSystem ( [
80+ {
81+ path : `${ projectRoot } /tsconfig.json` ,
82+ content : JSON . stringify ( {
83+ compilerOptions : { moduleResolution : "node16" } ,
84+ } )
85+ } ,
86+ {
87+ path : `${ projectRoot } /index.ts` ,
88+ content : Utils . dedent `
89+ import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
90+ import type { RequireInterface } from "pkg1" assert { "resolution-mode": "require" };
91+ import {x} from "./a";
92+ `
93+ } ,
94+ {
95+ path : `${ projectRoot } /a.ts` ,
96+ content : Utils . dedent `
97+ export const x = 10;
98+ `
99+ } ,
100+ {
101+ path : `${ projectRoot } /node_modules/pkg/package.json` ,
102+ content : JSON . stringify ( {
103+ name : "pkg" ,
104+ version : "0.0.1" ,
105+ exports : {
106+ import : "./import.js" ,
107+ require : "./require.js"
108+ }
109+ } )
110+ } ,
111+ {
112+ path : `${ projectRoot } /node_modules/pkg/import.d.ts` ,
113+ content : `export interface ImportInterface {}`
114+ } ,
115+ {
116+ path : `${ projectRoot } /node_modules/pkg/require.d.ts` ,
117+ content : `export interface RequireInterface {}`
118+ } ,
119+ {
120+ path : `${ projectRoot } /node_modules/pkg1/package.json` ,
121+ content : JSON . stringify ( {
122+ name : "pkg1" ,
123+ version : "0.0.1" ,
124+ exports : {
125+ import : "./import.js" ,
126+ require : "./require.js"
127+ }
128+ } )
129+ } ,
130+ {
131+ path : `${ projectRoot } /node_modules/pkg1/import.d.ts` ,
132+ content : `export interface ImportInterface {}`
133+ } ,
134+ libFile
135+ ] , { currentDirectory : projectRoot } ) ,
136+ commandLineArgs : [ "-w" , "--traceResolution" ] ,
137+ changes : [
138+ {
139+ caption : "modify aFile by adding import" ,
140+ change : sys => sys . appendFile ( `${ projectRoot } /a.ts` , `import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }` ) ,
141+ timeouts : sys => sys . runQueuedTimeoutCallbacks ( ) ,
142+ }
143+ ]
144+ } ) ;
75145 } ) ;
76146}
0 commit comments