@@ -106,12 +106,15 @@ test('the entry names its exports: export * is refused', () => {
106106 "export type * from './a.ts';" ,
107107 "export { a } from './a.ts';\nexport type * as ns from './b.ts';" ,
108108 ] ) {
109- const found = check ( { } , new Map ( [ [ 'packages/test-kit/src/index.ts' , body ] ] ) ) ;
109+ const found = check ( { } , new Map ( [ ... SOURCE , [ 'packages/test-kit/src/index.ts' , body ] ] ) ) ;
110110 assert . equal ( found . length , 1 , body ) ;
111111 assert . match ( found [ 0 ] ! . message , / n a m e s e v e r y e x p o r t e x p l i c i t l y / ) ;
112112 }
113113 assert . deepEqual (
114- check ( { } , new Map ( [ [ 'packages/test-kit/src/index.ts' , "export { a } from './a.ts';" ] ] ) ) ,
114+ check (
115+ { } ,
116+ new Map ( [ ...SOURCE , [ 'packages/test-kit/src/index.ts' , "export { a } from './a.ts';" ] ] ) ,
117+ ) ,
115118 [ ] ,
116119 ) ;
117120} ) ;
@@ -120,7 +123,7 @@ test('text that only mentions a star is not an export', () => {
120123 const body =
121124 "// export * from './a.ts' is forbidden here\n" +
122125 "const note = `export * from './b.ts'`;\nexport { note };\nexport { a } from './a.ts';" ;
123- assert . deepEqual ( check ( { } , new Map ( [ [ 'packages/test-kit/src/index.ts' , body ] ] ) ) , [ ] ) ;
126+ assert . deepEqual ( check ( { } , new Map ( [ ... SOURCE , [ 'packages/test-kit/src/index.ts' , body ] ] ) ) , [ ] ) ;
124127} ) ;
125128
126129test ( 'the daemon entry names its exports: export * is refused' , ( ) => {
@@ -154,3 +157,18 @@ test('the shared isolation walk runs under the test-kit policy', () => {
154157 assert . equal ( found . length , 1 ) ;
155158 assert . match ( found [ 0 ] ! . message , / t e s t - k i t - > @ a g e n t - d e v i c e \/ d a e m o n / ) ;
156159} ) ;
160+
161+ for ( const dir of [ 'daemon' , 'test-kit' ] ) {
162+ test ( `${ dir } refuses a missing or renamed entry source` , ( ) => {
163+ for ( const renamed of [ false , true ] ) {
164+ const sources = new Map ( SOURCE ) ;
165+ const file = `packages/${ dir } /src/index.ts` ;
166+ sources . delete ( file ) ;
167+ if ( renamed ) sources . set ( `packages/${ dir } /src/renamed.ts` , "export * from './a.ts';" ) ;
168+ const found = check ( { } , sources ) ;
169+ assert . equal ( found . length , 1 ) ;
170+ assert . equal ( found [ 0 ] ! . file , file ) ;
171+ assert . match ( found [ 0 ] ! . message , / e n t r y s o u r c e i s m i s s i n g / ) ;
172+ }
173+ } ) ;
174+ }
0 commit comments