diff --git a/packages/bazel/test/ng_package/BUILD.bazel b/packages/bazel/test/ng_package/BUILD.bazel index 6389c87dbe..dd4d1d57b0 100644 --- a/packages/bazel/test/ng_package/BUILD.bazel +++ b/packages/bazel/test/ng_package/BUILD.bazel @@ -12,6 +12,7 @@ ts_library( srcs = ["core_package.spec.ts"], deps = [ "//packages:types", + "//packages/private/testing", "@ngdeps//@types/shelljs", ], ) @@ -24,9 +25,6 @@ jasmine_node_test( "@ngdeps//@types/shelljs", "@ngdeps//shelljs", ], - tags = [ - "fixme-ivy-aot", - ], ) ts_library( diff --git a/packages/bazel/test/ng_package/core_package.spec.ts b/packages/bazel/test/ng_package/core_package.spec.ts index 8c92f66c29..0a41d7f386 100644 --- a/packages/bazel/test/ng_package/core_package.spec.ts +++ b/packages/bazel/test/ng_package/core_package.spec.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +import {fixmeIvy, ivyEnabled, obsoleteInIvy} from '@angular/private/testing'; import * as path from 'path'; import * as shx from 'shelljs'; @@ -73,8 +74,10 @@ describe('@angular/core ng_package', () => { describe('typescript support', () => { - it('should have an index.d.ts file', - () => { expect(shx.cat('core.d.ts')).toContain(`export *`); }); + fixmeIvy('FW-738: ngtsc doesn\'t generate flat index files') && + it('should have an index d.ts file', + () => { expect(shx.cat('core.d.ts')).toContain(`export *`); }); + it('should not have amd module names', () => { expect(shx.cat('public_api.d.ts')).not.toContain(' { }); - describe('angular metadata', () => { + obsoleteInIvy('metadata files are no longer needed or produced in Ivy') && + describe('angular metadata', () => { - it('should have metadata.json files', - () => { expect(shx.cat('core.metadata.json')).toContain(`"__symbolic":"module"`); }); - }); + it('should have metadata.json files', + () => { expect(shx.cat('core.metadata.json')).toContain(`"__symbolic":"module"`); }); + }); describe('fesm2015', () => { @@ -108,8 +112,10 @@ describe('@angular/core ng_package', () => { .toMatch(/@license Angular v\d+\.\d+\.\d+(?!-PLACEHOLDER)/); }); - it('should have been built from the generated bundle index', - () => { expect(shx.cat('fesm2015/core.js')).toMatch('export {.*makeParamDecorator'); }); + obsoleteInIvy('we no longer need to export private symbols') && + it('should have been built from the generated bundle index', () => { + expect(shx.cat('fesm2015/core.js')).toMatch('export {.*makeParamDecorator'); + }); }); @@ -126,16 +132,24 @@ describe('@angular/core ng_package', () => { expect(shx.cat('fesm5/core.js')).not.toContain('@fileoverview added by tsickle'); }); - it('should have decorators', - () => { expect(shx.cat('fesm5/core.js')).toContain('__decorate'); }); + if (ivyEnabled) { + it('should have decorators downleveled to static props e.g. ngInjectableDef', () => { + expect(shx.cat('fesm5/core.js')).not.toContain('__decorate'); + expect(shx.cat('fesm5/core.js')).toContain('.ngInjectableDef = '); + }); + } else { + it('should have decorators', + () => { expect(shx.cat('fesm5/core.js')).toContain('__decorate'); }); + } it('should load tslib from external bundle', () => { expect(shx.cat('fesm5/core.js')).not.toContain('function __extends'); expect(shx.cat('fesm5/core.js')).toMatch('import {.*__extends'); }); - it('should have been built from the generated bundle index', - () => { expect(shx.cat('fesm5/core.js')).toMatch('export {.*makeParamDecorator'); }); + obsoleteInIvy('we no longer need to export private symbols') && + it('should have been built from the generated bundle index', + () => { expect(shx.cat('fesm5/core.js')).toMatch('export {.*makeParamDecorator'); }); }); @@ -212,24 +226,21 @@ describe('@angular/core ng_package', () => { const typingsFile = p `testing/index.d.ts`; it('should have a typings file', () => { expect(shx.cat(typingsFile)).toContain('export * from \'./public_api\';'); }); - }); - describe('typescript support', () => { - // TODO(i): why in the parent dir? - it('should have an \'redirect\' d.ts file in the parent dir', - () => { expect(shx.cat('testing.d.ts')).toContain(`export *`); }); - - it('should have a \'actual\' d.ts file in the parent dir', () => { - expect(shx.cat('testing/index.d.ts')).toContain(`export * from './public_api';`); - }); + obsoleteInIvy( + 'now that we don\'t need metadata files, we don\'t need these redirects to help resolve paths to them') && + it('should have an \'redirect\' d.ts file in the parent dir', + () => { expect(shx.cat('testing.d.ts')).toContain(`export *`); }); }); - describe('angular metadata file', () => { - it('should have a \'redirect\' metadata.json file next to the d.ts file', () => { - expect(shx.cat('testing.metadata.json')) - .toContain(`"exports":[{"from":"./testing/testing"}],"flatModuleIndexRedirect":true`); - }); - }); + obsoleteInIvy('metadata files are no longer needed or produced in Ivy') && + describe('angular metadata file', () => { + it('should have a \'redirect\' metadata.json file next to the d.ts file', () => { + expect(shx.cat('testing.metadata.json')) + .toContain( + `"exports":[{"from":"./testing/testing"}],"flatModuleIndexRedirect":true`); + }); + }); describe('fesm2015', () => { it('should have a fesm15 file in the /fesm2015 directory',