@@ -1610,39 +1610,87 @@ namespace ts.projectSystem {
1610
1610
checkNumberOfInferredProjects ( projectService , 0 ) ;
1611
1611
} ) ;
1612
1612
1613
- it ( "file opened is in configured project that will be removed" , ( ) => {
1614
- const testsConfig : File = {
1615
- path : `${ tscWatch . projectRoot } /playground/tsconfig.json` ,
1616
- content : "{}"
1617
- } ;
1618
- const testsFile : File = {
1619
- path : `${ tscWatch . projectRoot } /playground/tests.ts` ,
1620
- content : `export function foo() {}`
1621
- } ;
1622
- const innerFile : File = {
1623
- path : `${ tscWatch . projectRoot } /playground/tsconfig-json/tests/spec.ts` ,
1624
- content : `export function bar() { }`
1625
- } ;
1626
- const innerConfig : File = {
1627
- path : `${ tscWatch . projectRoot } /playground/tsconfig-json/tsconfig.json` ,
1628
- content : JSON . stringify ( {
1629
- include : [ "./src" ]
1613
+ describe ( "file opened is in configured project that will be removed" , ( ) => {
1614
+ function runOnTs < T extends server . protocol . Request > ( scenario : string , getRequest : ( innerFile : File ) => Partial < T > ) {
1615
+ it ( scenario , ( ) => {
1616
+ const testsConfig : File = {
1617
+ path : `${ tscWatch . projectRoot } /playground/tsconfig.json` ,
1618
+ content : "{}"
1619
+ } ;
1620
+ const testsFile : File = {
1621
+ path : `${ tscWatch . projectRoot } /playground/tests.ts` ,
1622
+ content : `export function foo() {}`
1623
+ } ;
1624
+ const innerFile : File = {
1625
+ path : `${ tscWatch . projectRoot } /playground/tsconfig-json/tests/spec.ts` ,
1626
+ content : `export function bar() { }`
1627
+ } ;
1628
+ const innerConfig : File = {
1629
+ path : `${ tscWatch . projectRoot } /playground/tsconfig-json/tsconfig.json` ,
1630
+ content : JSON . stringify ( {
1631
+ include : [ "./src" ]
1632
+ } )
1633
+ } ;
1634
+ const innerSrcFile : File = {
1635
+ path : `${ tscWatch . projectRoot } /playground/tsconfig-json/src/src.ts` ,
1636
+ content : `export function foobar() { }`
1637
+ } ;
1638
+ const host = createServerHost ( [ testsConfig , testsFile , innerFile , innerConfig , innerSrcFile , libFile ] ) ;
1639
+ const session = createSession ( host , { logger : createLoggerWithInMemoryLogs ( host ) } ) ;
1640
+ openFilesForSession ( [ testsFile ] , session ) ;
1641
+ closeFilesForSession ( [ testsFile ] , session ) ;
1642
+ openFilesForSession ( [ innerFile ] , session ) ;
1643
+ session . executeCommandSeq ( getRequest ( innerFile ) ) ;
1644
+ baselineTsserverLogs ( "projects" , scenario , session ) ;
1645
+ } ) ;
1646
+ }
1647
+ runOnTs < protocol . OutliningSpansRequest > (
1648
+ "file opened is in configured project that will be removed" ,
1649
+ innerFile => ( {
1650
+ command : protocol . CommandTypes . GetOutliningSpans ,
1651
+ arguments : { file : innerFile . path }
1630
1652
} )
1631
- } ;
1632
- const innerSrcFile : File = {
1633
- path : `${ tscWatch . projectRoot } /playground/tsconfig-json/src/src.ts` ,
1634
- content : `export function foobar() { }`
1635
- } ;
1636
- const host = createServerHost ( [ testsConfig , testsFile , innerFile , innerConfig , innerSrcFile , libFile ] ) ;
1637
- const session = createSession ( host , { logger : createLoggerWithInMemoryLogs ( host ) } ) ;
1638
- openFilesForSession ( [ testsFile ] , session ) ;
1639
- closeFilesForSession ( [ testsFile ] , session ) ;
1640
- openFilesForSession ( [ innerFile ] , session ) ;
1641
- session . executeCommandSeq < protocol . OutliningSpansRequest > ( {
1642
- command : protocol . CommandTypes . GetOutliningSpans ,
1643
- arguments : { file : innerFile . path }
1653
+ ) ;
1654
+
1655
+ runOnTs < protocol . ReferencesRequest > (
1656
+ "references on file opened is in configured project that will be removed" ,
1657
+ innerFile => ( {
1658
+ command : protocol . CommandTypes . References ,
1659
+ arguments : protocolFileLocationFromSubstring ( innerFile , "bar" )
1660
+ } )
1661
+ ) ;
1662
+
1663
+ it ( "js file opened is in configured project that will be removed" , ( ) => {
1664
+ const rootConfig : File = {
1665
+ path : `${ tscWatch . projectRoot } /tsconfig.json` ,
1666
+ content : JSON . stringify ( { compilerOptions : { allowJs : true } } )
1667
+ } ;
1668
+ const mocksFile : File = {
1669
+ path : `${ tscWatch . projectRoot } /mocks/cssMock.js` ,
1670
+ content : `function foo() { }`
1671
+ } ;
1672
+ const innerFile : File = {
1673
+ path : `${ tscWatch . projectRoot } /apps/editor/scripts/createConfigVariable.js` ,
1674
+ content : `function bar() { }`
1675
+ } ;
1676
+ const innerConfig : File = {
1677
+ path : `${ tscWatch . projectRoot } /apps/editor/tsconfig.json` ,
1678
+ content : JSON . stringify ( {
1679
+ extends : "../../tsconfig.json" ,
1680
+ include : [ "./src" ] ,
1681
+ } )
1682
+ } ;
1683
+ const innerSrcFile : File = {
1684
+ path : `${ tscWatch . projectRoot } /apps/editor/src/src.js` ,
1685
+ content : `function fooBar() { }`
1686
+ } ;
1687
+ const host = createServerHost ( [ rootConfig , mocksFile , innerFile , innerConfig , innerSrcFile , libFile ] ) ;
1688
+ const session = createSession ( host , { canUseEvents : true , logger : createLoggerWithInMemoryLogs ( host ) } ) ;
1689
+ openFilesForSession ( [ mocksFile ] , session ) ;
1690
+ closeFilesForSession ( [ mocksFile ] , session ) ;
1691
+ openFilesForSession ( [ innerFile ] , session ) ;
1692
+ baselineTsserverLogs ( "projects" , "js file opened is in configured project that will be removed" , session ) ;
1644
1693
} ) ;
1645
- baselineTsserverLogs ( "projects" , "file opened is in configured project that will be removed" , session ) ;
1646
1694
} ) ;
1647
1695
} ) ;
1648
1696
}
0 commit comments