@@ -1433,6 +1433,7 @@ function foo() {
1433
1433
aTest : File ;
1434
1434
bFoo : File ;
1435
1435
bBar : File ;
1436
+ bSymlink : SymLink ;
1436
1437
}
1437
1438
function verifySymlinkScenario ( packages : ( ) => Packages ) {
1438
1439
describe ( "when solution is not built" , ( ) => {
@@ -1456,13 +1457,9 @@ function foo() {
1456
1457
} ) ;
1457
1458
}
1458
1459
1459
- function verifySession ( { bPackageJson, aTest, bFoo, bBar } : Packages , alreadyBuilt : boolean , extraOptions : CompilerOptions ) {
1460
+ function verifySession ( { bPackageJson, aTest, bFoo, bBar, bSymlink } : Packages , alreadyBuilt : boolean , extraOptions : CompilerOptions ) {
1460
1461
const aConfig = config ( "A" , extraOptions , [ "../B" ] ) ;
1461
1462
const bConfig = config ( "B" , extraOptions ) ;
1462
- const bSymlink : SymLink = {
1463
- path : `${ tscWatch . projectRoot } /node_modules/b` ,
1464
- symLink : `${ tscWatch . projectRoot } /packages/B`
1465
- } ;
1466
1463
const files = [ libFile , bPackageJson , aConfig , bConfig , aTest , bFoo , bBar , bSymlink ] ;
1467
1464
const host = alreadyBuilt ?
1468
1465
createHost ( files , [ aConfig . path ] ) :
@@ -1485,6 +1482,26 @@ function foo() {
1485
1482
{ file : aTest , syntax : [ ] , semantic : [ ] , suggestion : [ ] }
1486
1483
]
1487
1484
} ) ;
1485
+ session . executeCommandSeq < protocol . UpdateOpenRequest > ( {
1486
+ command : protocol . CommandTypes . UpdateOpen ,
1487
+ arguments : {
1488
+ changedFiles : [ {
1489
+ fileName : aTest . path ,
1490
+ textChanges : [ {
1491
+ newText : "\n" ,
1492
+ start : { line : 5 , offset : 1 } ,
1493
+ end : { line : 5 , offset : 1 }
1494
+ } ]
1495
+ } ]
1496
+ }
1497
+ } ) ;
1498
+ verifyGetErrRequest ( {
1499
+ host,
1500
+ session,
1501
+ expected : [
1502
+ { file : aTest , syntax : [ ] , semantic : [ ] , suggestion : [ ] }
1503
+ ]
1504
+ } ) ;
1488
1505
}
1489
1506
1490
1507
function config ( packageName : string , extraOptions : CompilerOptions , references ?: string [ ] ) : File {
@@ -1510,37 +1527,55 @@ function foo() {
1510
1527
} ;
1511
1528
}
1512
1529
1513
- describe ( "when packageJson has types field and has index.ts" , ( ) => {
1514
- verifySymlinkScenario ( ( ) => ( {
1515
- bPackageJson : {
1516
- path : `${ tscWatch . projectRoot } /packages/B/package.json` ,
1517
- content : JSON . stringify ( {
1518
- main : "lib/index.js" ,
1519
- types : "lib/index.d.ts"
1520
- } )
1521
- } ,
1522
- aTest : file ( "A" , "index.ts" , `import { foo } from 'b';
1523
- import { bar } from 'b/lib/bar';
1530
+ function verifyMonoRepoLike ( scope = "" ) {
1531
+ describe ( "when packageJson has types field and has index.ts" , ( ) => {
1532
+ verifySymlinkScenario ( ( ) => ( {
1533
+ bPackageJson : {
1534
+ path : `${ tscWatch . projectRoot } /packages/B/package.json` ,
1535
+ content : JSON . stringify ( {
1536
+ main : "lib/index.js" ,
1537
+ types : "lib/index.d.ts"
1538
+ } )
1539
+ } ,
1540
+ aTest : file ( "A" , "index.ts" , `import { foo } from '${ scope } b';
1541
+ import { bar } from '${ scope } b/lib/bar';
1524
1542
foo();
1525
- bar();` ) ,
1526
- bFoo : file ( "B" , "index.ts" , `export function foo() { }` ) ,
1527
- bBar : file ( "B" , "bar.ts" , `export function bar() { }` )
1528
- } ) ) ;
1529
- } ) ;
1543
+ bar();
1544
+ ` ) ,
1545
+ bFoo : file ( "B" , "index.ts" , `export function foo() { }` ) ,
1546
+ bBar : file ( "B" , "bar.ts" , `export function bar() { }` ) ,
1547
+ bSymlink : {
1548
+ path : `${ tscWatch . projectRoot } /node_modules/${ scope } b` ,
1549
+ symLink : `${ tscWatch . projectRoot } /packages/B`
1550
+ }
1551
+ } ) ) ;
1552
+ } ) ;
1530
1553
1531
- describe ( "when referencing file from subFolder" , ( ) => {
1532
- verifySymlinkScenario ( ( ) => ( {
1533
- bPackageJson : {
1534
- path : `${ tscWatch . projectRoot } /packages/B/package.json` ,
1535
- content : "{}"
1536
- } ,
1537
- aTest : file ( "A" , "test.ts" , `import { foo } from 'b/lib/foo';
1538
- import { bar } from 'b/lib/bar/foo';
1554
+ describe ( "when referencing file from subFolder" , ( ) => {
1555
+ verifySymlinkScenario ( ( ) => ( {
1556
+ bPackageJson : {
1557
+ path : `${ tscWatch . projectRoot } /packages/B/package.json` ,
1558
+ content : "{}"
1559
+ } ,
1560
+ aTest : file ( "A" , "test.ts" , `import { foo } from '${ scope } b/lib/foo';
1561
+ import { bar } from '${ scope } b/lib/bar/foo';
1539
1562
foo();
1540
- bar();` ) ,
1541
- bFoo : file ( "B" , "foo.ts" , `export function foo() { }` ) ,
1542
- bBar : file ( "B" , "bar/foo.ts" , `export function bar() { }` )
1543
- } ) ) ;
1563
+ bar();
1564
+ ` ) ,
1565
+ bFoo : file ( "B" , "foo.ts" , `export function foo() { }` ) ,
1566
+ bBar : file ( "B" , "bar/foo.ts" , `export function bar() { }` ) ,
1567
+ bSymlink : {
1568
+ path : `${ tscWatch . projectRoot } /node_modules/${ scope } b` ,
1569
+ symLink : `${ tscWatch . projectRoot } /packages/B`
1570
+ }
1571
+ } ) ) ;
1572
+ } ) ;
1573
+ }
1574
+ describe ( "when package is not scoped" , ( ) => {
1575
+ verifyMonoRepoLike ( ) ;
1576
+ } ) ;
1577
+ describe ( "when package is scoped" , ( ) => {
1578
+ verifyMonoRepoLike ( "@issue/" ) ;
1544
1579
} ) ;
1545
1580
} ) ;
1546
1581
0 commit comments