@@ -1839,5 +1839,61 @@ bar();
1839
1839
// No new solutions/projects loaded
1840
1840
checkNumberOfProjects ( service , { configuredProjects : 1 } ) ;
1841
1841
} ) ;
1842
+
1843
+ it ( "when default project is solution project" , ( ) => {
1844
+ const tsconfigSrc : File = {
1845
+ path : `${ tscWatch . projectRoot } /tsconfig-src.json` ,
1846
+ content : JSON . stringify ( {
1847
+ compilerOptions : {
1848
+ composite : true ,
1849
+ outDir : "./target/" ,
1850
+ baseUrl : "./src/"
1851
+ } ,
1852
+ include : [ "./src/**/*" ]
1853
+ } )
1854
+ } ;
1855
+ const tsconfig : File = {
1856
+ path : `${ tscWatch . projectRoot } /tsconfig.json` ,
1857
+ content : JSON . stringify ( {
1858
+ references : [ { path : "./tsconfig-src.json" } ] ,
1859
+ files : [ ]
1860
+ } )
1861
+ } ;
1862
+ const main : File = {
1863
+ path : `${ tscWatch . projectRoot } /src/main.ts` ,
1864
+ content : `import { foo } from 'helpers/functions';
1865
+ foo;`
1866
+ } ;
1867
+ const helper : File = {
1868
+ path : `${ tscWatch . projectRoot } /src/helpers/functions.ts` ,
1869
+ content : `export const foo = 1;`
1870
+ } ;
1871
+ const host = createServerHost ( [ tsconfigSrc , tsconfig , main , helper , libFile ] ) ;
1872
+ const session = createSession ( host , { canUseEvents : true } ) ;
1873
+ const service = session . getProjectService ( ) ;
1874
+ service . openClientFile ( main . path ) ;
1875
+ checkNumberOfProjects ( service , { configuredProjects : 1 , inferredProjects : 1 } ) ;
1876
+ checkProjectActualFiles ( service . inferredProjects [ 0 ] , [ main . path , libFile . path ] ) ;
1877
+ checkProjectActualFiles ( service . configuredProjects . get ( tsconfig . path ) ! , [ tsconfig . path ] ) ;
1878
+
1879
+ const location = protocolTextSpanFromSubstring ( main . content , `'helpers/functions'` ) ;
1880
+ verifyGetErrRequest ( {
1881
+ session,
1882
+ host,
1883
+ expected : [
1884
+ {
1885
+ file : main ,
1886
+ syntax : [ ] ,
1887
+ semantic : [ createDiagnostic (
1888
+ location . start ,
1889
+ location . end ,
1890
+ Diagnostics . Cannot_find_module_0 ,
1891
+ [ "helpers/functions" ]
1892
+ ) ] ,
1893
+ suggestion : [ ]
1894
+ } ,
1895
+ ]
1896
+ } ) ;
1897
+ } ) ;
1842
1898
} ) ;
1843
1899
}
0 commit comments