66 * found in the LICENSE file at https://angular.io/license
77 */
88
9+ import { fixmeIvy , ivyEnabled , obsoleteInIvy } from '@angular/private/testing' ;
910import * as path from 'path' ;
1011import * as shx from 'shelljs' ;
1112
@@ -73,8 +74,10 @@ describe('@angular/core ng_package', () => {
7374
7475 describe ( 'typescript support' , ( ) => {
7576
76- it ( 'should have an index.d.ts file' ,
77- ( ) => { expect ( shx . cat ( 'core.d.ts' ) ) . toContain ( `export *` ) ; } ) ;
77+ fixmeIvy ( 'FW-738: ngtsc doesn\'t generate flat index files' ) &&
78+ it ( 'should have an index d.ts file' ,
79+ ( ) => { expect ( shx . cat ( 'core.d.ts' ) ) . toContain ( `export *` ) ; } ) ;
80+
7881 it ( 'should not have amd module names' ,
7982 ( ) => { expect ( shx . cat ( 'public_api.d.ts' ) ) . not . toContain ( '<amd-module name' ) ; } ) ;
8083 } ) ;
@@ -87,11 +90,12 @@ describe('@angular/core ng_package', () => {
8790 } ) ;
8891
8992
90- describe ( 'angular metadata' , ( ) => {
93+ obsoleteInIvy ( 'metadata files are no longer needed or produced in Ivy' ) &&
94+ describe ( 'angular metadata' , ( ) => {
9195
92- it ( 'should have metadata.json files' ,
93- ( ) => { expect ( shx . cat ( 'core.metadata.json' ) ) . toContain ( `"__symbolic":"module"` ) ; } ) ;
94- } ) ;
96+ it ( 'should have metadata.json files' ,
97+ ( ) => { expect ( shx . cat ( 'core.metadata.json' ) ) . toContain ( `"__symbolic":"module"` ) ; } ) ;
98+ } ) ;
9599
96100
97101 describe ( 'fesm2015' , ( ) => {
@@ -108,8 +112,10 @@ describe('@angular/core ng_package', () => {
108112 . toMatch ( / @ l i c e n s e A n g u l a r v \d + \. \d + \. \d + (? ! - P L A C E H O L D E R ) / ) ;
109113 } ) ;
110114
111- it ( 'should have been built from the generated bundle index' ,
112- ( ) => { expect ( shx . cat ( 'fesm2015/core.js' ) ) . toMatch ( 'export {.*makeParamDecorator' ) ; } ) ;
115+ obsoleteInIvy ( 'we no longer need to export private symbols' ) &&
116+ it ( 'should have been built from the generated bundle index' , ( ) => {
117+ expect ( shx . cat ( 'fesm2015/core.js' ) ) . toMatch ( 'export {.*makeParamDecorator' ) ;
118+ } ) ;
113119 } ) ;
114120
115121
@@ -126,16 +132,24 @@ describe('@angular/core ng_package', () => {
126132 expect ( shx . cat ( 'fesm5/core.js' ) ) . not . toContain ( '@fileoverview added by tsickle' ) ;
127133 } ) ;
128134
129- it ( 'should have decorators' ,
130- ( ) => { expect ( shx . cat ( 'fesm5/core.js' ) ) . toContain ( '__decorate' ) ; } ) ;
135+ if ( ivyEnabled ) {
136+ it ( 'should have decorators downleveled to static props e.g. ngInjectableDef' , ( ) => {
137+ expect ( shx . cat ( 'fesm5/core.js' ) ) . not . toContain ( '__decorate' ) ;
138+ expect ( shx . cat ( 'fesm5/core.js' ) ) . toContain ( '.ngInjectableDef = ' ) ;
139+ } ) ;
140+ } else {
141+ it ( 'should have decorators' ,
142+ ( ) => { expect ( shx . cat ( 'fesm5/core.js' ) ) . toContain ( '__decorate' ) ; } ) ;
143+ }
131144
132145 it ( 'should load tslib from external bundle' , ( ) => {
133146 expect ( shx . cat ( 'fesm5/core.js' ) ) . not . toContain ( 'function __extends' ) ;
134147 expect ( shx . cat ( 'fesm5/core.js' ) ) . toMatch ( 'import {.*__extends' ) ;
135148 } ) ;
136149
137- it ( 'should have been built from the generated bundle index' ,
138- ( ) => { expect ( shx . cat ( 'fesm5/core.js' ) ) . toMatch ( 'export {.*makeParamDecorator' ) ; } ) ;
150+ obsoleteInIvy ( 'we no longer need to export private symbols' ) &&
151+ it ( 'should have been built from the generated bundle index' ,
152+ ( ) => { expect ( shx . cat ( 'fesm5/core.js' ) ) . toMatch ( 'export {.*makeParamDecorator' ) ; } ) ;
139153 } ) ;
140154
141155
@@ -212,24 +226,21 @@ describe('@angular/core ng_package', () => {
212226 const typingsFile = p `testing/index.d.ts` ;
213227 it ( 'should have a typings file' ,
214228 ( ) => { expect ( shx . cat ( typingsFile ) ) . toContain ( 'export * from \'./public_api\';' ) ; } ) ;
215- } ) ;
216- describe ( 'typescript support' , ( ) => {
217229
218- // TODO(i): why in the parent dir?
219- it ( 'should have an \'redirect\' d.ts file in the parent dir' ,
220- ( ) => { expect ( shx . cat ( 'testing.d.ts' ) ) . toContain ( `export *` ) ; } ) ;
221-
222- it ( 'should have a \'actual\' d.ts file in the parent dir' , ( ) => {
223- expect ( shx . cat ( 'testing/index.d.ts' ) ) . toContain ( `export * from './public_api';` ) ;
224- } ) ;
230+ obsoleteInIvy (
231+ 'now that we don\'t need metadata files, we don\'t need these redirects to help resolve paths to them' ) &&
232+ it ( 'should have an \'redirect\' d.ts file in the parent dir' ,
233+ ( ) => { expect ( shx . cat ( 'testing.d.ts' ) ) . toContain ( `export *` ) ; } ) ;
225234 } ) ;
226235
227- describe ( 'angular metadata file' , ( ) => {
228- it ( 'should have a \'redirect\' metadata.json file next to the d.ts file' , ( ) => {
229- expect ( shx . cat ( 'testing.metadata.json' ) )
230- . toContain ( `"exports":[{"from":"./testing/testing"}],"flatModuleIndexRedirect":true` ) ;
231- } ) ;
232- } ) ;
236+ obsoleteInIvy ( 'metadata files are no longer needed or produced in Ivy' ) &&
237+ describe ( 'angular metadata file' , ( ) => {
238+ it ( 'should have a \'redirect\' metadata.json file next to the d.ts file' , ( ) => {
239+ expect ( shx . cat ( 'testing.metadata.json' ) )
240+ . toContain (
241+ `"exports":[{"from":"./testing/testing"}],"flatModuleIndexRedirect":true` ) ;
242+ } ) ;
243+ } ) ;
233244
234245 describe ( 'fesm2015' , ( ) => {
235246 it ( 'should have a fesm15 file in the /fesm2015 directory' ,
0 commit comments