|
|
|
@ -41,8 +41,9 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
describe('package.json', () => {
|
|
|
|
|
const packageJson = 'package.json';
|
|
|
|
|
|
|
|
|
|
it('should have a package.json file',
|
|
|
|
|
() => { expect(shx.grep('"name":', packageJson)).toContain(`@angular/core`); });
|
|
|
|
|
it('should have a package.json file', () => {
|
|
|
|
|
expect(shx.grep('"name":', packageJson)).toContain(`@angular/core`);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should contain correct version number with the PLACEHOLDER string replaced', () => {
|
|
|
|
|
expect(shx.grep('"version":', packageJson)).toMatch(/\d+\.\d+\.\d+(?!-PLACEHOLDER)/);
|
|
|
|
@ -66,16 +67,20 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
|
|
|
|
|
describe('typescript support', () => {
|
|
|
|
|
if (ivyEnabled) {
|
|
|
|
|
it('should have an index d.ts file',
|
|
|
|
|
() => { expect(shx.cat('core.d.ts')).toContain(`export *`); });
|
|
|
|
|
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('<amd-module name'); });
|
|
|
|
|
it('should not have amd module names', () => {
|
|
|
|
|
expect(shx.cat('public_api.d.ts')).not.toContain('<amd-module name');
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
it('should have an index d.ts file',
|
|
|
|
|
() => { expect(shx.cat('core.d.ts')).toContain('export declare'); });
|
|
|
|
|
it('should have an r3_symbols d.ts file',
|
|
|
|
|
() => { expect(shx.cat('src/r3_symbols.d.ts')).toContain('export declare'); });
|
|
|
|
|
it('should have an index d.ts file', () => {
|
|
|
|
|
expect(shx.cat('core.d.ts')).toContain('export declare');
|
|
|
|
|
});
|
|
|
|
|
it('should have an r3_symbols d.ts file', () => {
|
|
|
|
|
expect(shx.cat('src/r3_symbols.d.ts')).toContain('export declare');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -87,15 +92,18 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
|
|
|
|
|
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 not have self-references in metadata.json',
|
|
|
|
|
() => { expect(shx.cat('core.metadata.json')).not.toContain(`"from":"./core"`); });
|
|
|
|
|
it('should have metadata.json files', () => {
|
|
|
|
|
expect(shx.cat('core.metadata.json')).toContain(`"__symbolic":"module"`);
|
|
|
|
|
});
|
|
|
|
|
it('should not have self-references in metadata.json', () => {
|
|
|
|
|
expect(shx.cat('core.metadata.json')).not.toContain(`"from":"./core"`);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('fesm2015', () => {
|
|
|
|
|
it('should have a fesm15 file in the /fesm2015 directory',
|
|
|
|
|
() => { expect(shx.cat('fesm2015/core.js')).toContain(`export {`); });
|
|
|
|
|
it('should have a fesm15 file in the /fesm2015 directory', () => {
|
|
|
|
|
expect(shx.cat('fesm2015/core.js')).toContain(`export {`);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a source map', () => {
|
|
|
|
|
expect(shx.cat('fesm2015/core.js.map'))
|
|
|
|
@ -114,8 +122,9 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('fesm5', () => {
|
|
|
|
|
it('should have a fesm5 file in the /fesm5 directory',
|
|
|
|
|
() => { expect(shx.cat('fesm5/core.js')).toContain(`export {`); });
|
|
|
|
|
it('should have a fesm5 file in the /fesm5 directory', () => {
|
|
|
|
|
expect(shx.cat('fesm5/core.js')).toContain(`export {`);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a source map', () => {
|
|
|
|
|
expect(shx.cat('fesm5/core.js.map')).toContain(`{"version":3,"file":"core.js","sources":`);
|
|
|
|
@ -131,12 +140,14 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
expect(shx.cat('fesm5/core.js')).toContain('.ɵprov = ');
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
it('should have decorators',
|
|
|
|
|
() => { expect(shx.cat('fesm5/core.js')).toContain('__decorate'); });
|
|
|
|
|
it('should have decorators', () => {
|
|
|
|
|
expect(shx.cat('fesm5/core.js')).toContain('__decorate');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// See: https://github.com/angular/angular/pull/32069
|
|
|
|
|
it('should retain access to const',
|
|
|
|
|
() => { expect(shx.cat('fesm5/core.js')).toContain('!ivyEnabled'); });
|
|
|
|
|
it('should retain access to const', () => {
|
|
|
|
|
expect(shx.cat('fesm5/core.js')).toContain('!ivyEnabled');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
it('should load tslib from external bundle', () => {
|
|
|
|
@ -145,8 +156,9 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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'); });
|
|
|
|
|
.it('should have been built from the generated bundle index', () => {
|
|
|
|
|
expect(shx.cat('fesm5/core.js')).toMatch('export {.*makeParamDecorator');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('esm2015', () => {
|
|
|
|
@ -160,25 +172,31 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('esm5', () => {
|
|
|
|
|
it('should not contain any *.ngfactory.js files',
|
|
|
|
|
() => { expect(shx.find('esm5').filter(f => f.endsWith('.ngfactory.js'))).toEqual([]); });
|
|
|
|
|
it('should not contain any *.ngfactory.js files', () => {
|
|
|
|
|
expect(shx.find('esm5').filter(f => f.endsWith('.ngfactory.js'))).toEqual([]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should not contain any *.ngsummary.js files',
|
|
|
|
|
() => { expect(shx.find('esm5').filter(f => f.endsWith('.ngsummary.js'))).toEqual([]); });
|
|
|
|
|
it('should not contain any *.ngsummary.js files', () => {
|
|
|
|
|
expect(shx.find('esm5').filter(f => f.endsWith('.ngsummary.js'))).toEqual([]);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('umd', () => {
|
|
|
|
|
it('should have a umd file in the /bundles directory',
|
|
|
|
|
() => { expect(shx.ls('bundles/core.umd.js').length).toBe(1, 'File not found'); });
|
|
|
|
|
it('should have a umd file in the /bundles directory', () => {
|
|
|
|
|
expect(shx.ls('bundles/core.umd.js').length).toBe(1, 'File not found');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a source map next to the umd file',
|
|
|
|
|
() => { expect(shx.ls('bundles/core.umd.js.map').length).toBe(1, 'File not found'); });
|
|
|
|
|
it('should have a source map next to the umd file', () => {
|
|
|
|
|
expect(shx.ls('bundles/core.umd.js.map').length).toBe(1, 'File not found');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a minified umd file in the /bundles directory',
|
|
|
|
|
() => { expect(shx.ls('bundles/core.umd.min.js').length).toBe(1, 'File not found'); });
|
|
|
|
|
it('should have a minified umd file in the /bundles directory', () => {
|
|
|
|
|
expect(shx.ls('bundles/core.umd.min.js').length).toBe(1, 'File not found');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a source map next to the minified umd file',
|
|
|
|
|
() => { expect(shx.ls('bundles/core.umd.min.js.map').length).toBe(1, 'File not found'); });
|
|
|
|
|
it('should have a source map next to the minified umd file', () => {
|
|
|
|
|
expect(shx.ls('bundles/core.umd.min.js.map').length).toBe(1, 'File not found');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have the version info in the header', () => {
|
|
|
|
|
expect(shx.cat('bundles/core.umd.js'))
|
|
|
|
@ -189,22 +207,25 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
expect(shx.cat('bundles/core.umd.js')).toContain('function __extends');
|
|
|
|
|
expect(shx.cat('bundles/core.umd.js')).not.toContain('undefined.__extends');
|
|
|
|
|
});
|
|
|
|
|
it('should have an AMD name',
|
|
|
|
|
() => { expect(shx.cat('bundles/core.umd.js')).toContain('define(\'@angular/core\''); });
|
|
|
|
|
it('should define ng global symbols',
|
|
|
|
|
() => { expect(shx.cat('bundles/core.umd.js')).toContain('global.ng.core = {}'); });
|
|
|
|
|
it('should have an AMD name', () => {
|
|
|
|
|
expect(shx.cat('bundles/core.umd.js')).toContain('define(\'@angular/core\'');
|
|
|
|
|
});
|
|
|
|
|
it('should define ng global symbols', () => {
|
|
|
|
|
expect(shx.cat('bundles/core.umd.js')).toContain('global.ng.core = {}');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('secondary entry-point', () => {
|
|
|
|
|
describe('package.json', () => {
|
|
|
|
|
const packageJson = p `testing/package.json`;
|
|
|
|
|
const packageJson = p`testing/package.json`;
|
|
|
|
|
|
|
|
|
|
it('should have a package.json file',
|
|
|
|
|
() => { expect(shx.grep('"name":', packageJson)).toContain(`@angular/core/testing`); });
|
|
|
|
|
it('should have a package.json file', () => {
|
|
|
|
|
expect(shx.grep('"name":', packageJson)).toContain(`@angular/core/testing`);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have its module resolution mappings defined in the nested package.json', () => {
|
|
|
|
|
const packageJson = p `testing/package.json`;
|
|
|
|
|
const packageJson = p`testing/package.json`;
|
|
|
|
|
expect(shx.grep('"main":', packageJson)).toContain(`../bundles/core-testing.umd.js`);
|
|
|
|
|
expect(shx.grep('"module":', packageJson)).toContain(`../fesm5/testing.js`);
|
|
|
|
|
expect(shx.grep('"es2015":', packageJson)).toContain(`../fesm2015/testing.js`);
|
|
|
|
@ -216,13 +237,15 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
|
|
|
|
|
describe('typings', () => {
|
|
|
|
|
if (ivyEnabled) {
|
|
|
|
|
const typingsFile = p `testing/index.d.ts`;
|
|
|
|
|
it('should have a typings file',
|
|
|
|
|
() => { expect(shx.cat(typingsFile)).toContain(`export * from './public_api';`); });
|
|
|
|
|
const typingsFile = p`testing/index.d.ts`;
|
|
|
|
|
it('should have a typings file', () => {
|
|
|
|
|
expect(shx.cat(typingsFile)).toContain(`export * from './public_api';`);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
const typingsFile = p `testing/testing.d.ts`;
|
|
|
|
|
it('should have a typings file',
|
|
|
|
|
() => { expect(shx.cat(typingsFile)).toContain('export declare'); });
|
|
|
|
|
const typingsFile = p`testing/testing.d.ts`;
|
|
|
|
|
it('should have a typings file', () => {
|
|
|
|
|
expect(shx.cat(typingsFile)).toContain('export declare');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obsoleteInIvy(
|
|
|
|
@ -242,8 +265,9 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('fesm2015', () => {
|
|
|
|
|
it('should have a fesm15 file in the /fesm2015 directory',
|
|
|
|
|
() => { expect(shx.cat('fesm2015/testing.js')).toContain(`export {`); });
|
|
|
|
|
it('should have a fesm15 file in the /fesm2015 directory', () => {
|
|
|
|
|
expect(shx.cat('fesm2015/testing.js')).toContain(`export {`);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a source map', () => {
|
|
|
|
|
expect(shx.cat('fesm2015/testing.js.map'))
|
|
|
|
@ -257,8 +281,9 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('fesm5', () => {
|
|
|
|
|
it('should have a fesm5 file in the /fesm5 directory',
|
|
|
|
|
() => { expect(shx.cat('fesm5/testing.js')).toContain(`export {`); });
|
|
|
|
|
it('should have a fesm5 file in the /fesm5 directory', () => {
|
|
|
|
|
expect(shx.cat('fesm5/testing.js')).toContain(`export {`);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a source map', () => {
|
|
|
|
|
expect(shx.cat('fesm5/testing.js.map'))
|
|
|
|
@ -267,8 +292,9 @@ describe('@angular/core ng_package', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('umd', () => {
|
|
|
|
|
it('should have a umd file in the /bundles directory',
|
|
|
|
|
() => { expect(shx.ls('bundles/core-testing.umd.js').length).toBe(1, 'File not found'); });
|
|
|
|
|
it('should have a umd file in the /bundles directory', () => {
|
|
|
|
|
expect(shx.ls('bundles/core-testing.umd.js').length).toBe(1, 'File not found');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a source map next to the umd file', () => {
|
|
|
|
|
expect(shx.ls('bundles/core-testing.umd.js.map').length).toBe(1, 'File not found');
|
|
|
|
|