@@ -476,6 +476,88 @@ bar();
476
476
} ) ;
477
477
} ) ;
478
478
479
+ it ( "when the referenced projects have allowJs and emitDeclarationOnly" , ( ) => {
480
+ const compositeConfig : File = {
481
+ path : `${ tscWatch . projectRoot } /packages/emit-composite/tsconfig.json` ,
482
+ content : JSON . stringify ( {
483
+ compilerOptions : {
484
+ composite : true ,
485
+ allowJs : true ,
486
+ emitDeclarationOnly : true ,
487
+ outDir : "lib" ,
488
+ rootDir : "src"
489
+ } ,
490
+ include : [ "src" ]
491
+ } )
492
+ } ;
493
+ const compositePackageJson : File = {
494
+ path : `${ tscWatch . projectRoot } /packages/emit-composite/package.json` ,
495
+ content : JSON . stringify ( {
496
+ name : "emit-composite" ,
497
+ version : "1.0.0" ,
498
+ main : "src/index.js" ,
499
+ typings : "lib/index.d.ts"
500
+ } )
501
+ } ;
502
+ const compositeIndex : File = {
503
+ path : `${ tscWatch . projectRoot } /packages/emit-composite/src/index.js` ,
504
+ content : `const testModule = require('./testModule');
505
+ module.exports = {
506
+ ...testModule
507
+ }`
508
+ } ;
509
+ const compositeTestModule : File = {
510
+ path : `${ tscWatch . projectRoot } /packages/emit-composite/src/testModule.js` ,
511
+ content : `/**
512
+ * @param {string} arg
513
+ */
514
+ const testCompositeFunction = (arg) => {
515
+ }
516
+ module.exports = {
517
+ testCompositeFunction
518
+ }`
519
+ } ;
520
+ const consumerConfig : File = {
521
+ path : `${ tscWatch . projectRoot } /packages/consumer/tsconfig.json` ,
522
+ content : JSON . stringify ( {
523
+ include : [ "src" ] ,
524
+ references : [ { path : "../emit-composite" } ]
525
+ } )
526
+ } ;
527
+ const consumerIndex : File = {
528
+ path : `${ tscWatch . projectRoot } /packages/consumer/src/index.ts` ,
529
+ content : `import { testCompositeFunction } from 'emit-composite';
530
+ testCompositeFunction('why hello there');
531
+ testCompositeFunction('why hello there', 42);`
532
+ } ;
533
+ const symlink : SymLink = {
534
+ path : `${ tscWatch . projectRoot } /node_modules/emit-composite` ,
535
+ symLink : `${ tscWatch . projectRoot } /packages/emit-composite`
536
+ } ;
537
+ const host = createServerHost ( [ libFile , compositeConfig , compositePackageJson , compositeIndex , compositeTestModule , consumerConfig , consumerIndex , symlink ] , { useCaseSensitiveFileNames : true } ) ;
538
+ const session = createSession ( host , { canUseEvents : true } ) ;
539
+ const service = session . getProjectService ( ) ;
540
+ openFilesForSession ( [ consumerIndex ] , session ) ;
541
+ checkNumberOfProjects ( service , { configuredProjects : 1 } ) ;
542
+ checkProjectActualFiles (
543
+ service . configuredProjects . get ( consumerConfig . path ) ! ,
544
+ [ consumerIndex . path , libFile . path , consumerConfig . path , compositeIndex . path , compositeTestModule . path ]
545
+ ) ;
546
+ const secondArg = protocolTextSpanFromSubstring ( consumerIndex . content , "42" ) ;
547
+ verifyGetErrRequest ( {
548
+ host,
549
+ session,
550
+ expected : [ {
551
+ file : consumerIndex ,
552
+ syntax : [ ] ,
553
+ semantic : [
554
+ createDiagnostic ( secondArg . start , secondArg . end , Diagnostics . Expected_0_arguments_but_got_1 , [ "1" , "2" ] ) ,
555
+ ] ,
556
+ suggestion : [ ]
557
+ } ]
558
+ } ) ;
559
+ } ) ;
560
+
479
561
it ( "when finding local reference doesnt load ancestor/sibling projects" , ( ) => {
480
562
const solutionLocation = "/user/username/projects/solution" ;
481
563
const solution : File = {
0 commit comments