build: reformat repo to new clang@1.4.0 (#36628)

PR Close #36628
This commit is contained in:
Joey Perrott
2020-04-13 17:43:52 -07:00
committed by atscott
parent 4b3f9ac739
commit 26f49151e7
1163 changed files with 31727 additions and 24036 deletions

View File

@ -30,8 +30,9 @@ describe('@angular/common ng_package', () => {
});
// regression test for https://github.com/angular/angular/issues/23217
// Note, we don't have an e2e test that covers this
it('doesn\'t pass require in a way that breaks webpack static analysis',
() => { expect(shx.cat('locales/fr.js')).not.toContain('factory(require, exports)'); });
it('doesn\'t pass require in a way that breaks webpack static analysis', () => {
expect(shx.cat('locales/fr.js')).not.toContain('factory(require, exports)');
});
});
it('should have right bundle files', () => {
@ -59,8 +60,9 @@ describe('@angular/common ng_package', () => {
]);
});
it('should reference core using global symbol in umd',
() => { expect(shx.cat('bundles/common.umd.js')).toContain('global.ng.core'); });
it('should reference core using global symbol in umd', () => {
expect(shx.cat('bundles/common.umd.js')).toContain('global.ng.core');
});
it('should have right fesm files', () => {
const expected = [

View File

@ -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');

View File

@ -11,7 +11,6 @@ import {existsSync, readFileSync} from 'fs';
import {dirname, join} from 'path';
describe('flat_module ng_module', () => {
let packageOutput: string;
let flatModuleOutFile: string;
@ -21,11 +20,11 @@ describe('flat_module ng_module', () => {
flatModuleOutFile = join(packageOutput, 'flat_module.js');
});
it('should have a flat module out file',
() => { expect(existsSync(flatModuleOutFile)).toBe(true); });
it('should have a flat module out file', () => {
expect(existsSync(flatModuleOutFile)).toBe(true);
});
describe('flat module out file', () => {
obsoleteInIvy('Ngtsc computes the AMD module name differently than NGC')
.it('should have a proper AMD module name', () => {
expect(readFileSync(flatModuleOutFile, 'utf8'))

View File

@ -11,7 +11,6 @@ import * as path from 'path';
import {setup} from './test_support';
describe('ngc_wrapped', () => {
it('should work', () => {
const {read, write, runOneBuild, writeConfig, shouldExist, basePath, typesRoots} = setup();

View File

@ -19,7 +19,9 @@ export interface TestSupport {
angularCorePath: string;
typesRoots: string;
writeConfig({
srcTargetPath, depPaths, pathMapping,
srcTargetPath,
depPaths,
pathMapping,
}: {
srcTargetPath: string,
depPaths?: string[],
@ -33,13 +35,13 @@ export interface TestSupport {
runOneBuild(): boolean;
}
export function setup(
{
bazelBin = 'bazel-bin', tsconfig = 'tsconfig.json',
}: {
bazelBin?: string,
tsconfig?: string,
} = {}): TestSupport {
export function setup({
bazelBin = 'bazel-bin',
tsconfig = 'tsconfig.json',
}: {
bazelBin?: string,
tsconfig?: string,
} = {}): TestSupport {
const runfilesPath = process.env['TEST_SRCDIR'];
const basePath = makeTempDir(runfilesPath);
@ -93,12 +95,17 @@ export function setup(
}
function writeFiles(...mockDirs: {[fileName: string]: string}[]) {
mockDirs.forEach(
(dir) => { Object.keys(dir).forEach((fileName) => { write(fileName, dir[fileName]); }); });
mockDirs.forEach((dir) => {
Object.keys(dir).forEach((fileName) => {
write(fileName, dir[fileName]);
});
});
}
function writeConfig({
srcTargetPath, depPaths = [], pathMapping = [],
srcTargetPath,
depPaths = [],
pathMapping = [],
}: {
srcTargetPath: string,
depPaths?: string[],
@ -133,7 +140,8 @@ export function setup(
defaultTsConfig: emptyTsConfig.config,
rootDir: basePath,
target: target,
outDir: bazelBinPath, compilationTargetSrc,
outDir: bazelBinPath,
compilationTargetSrc,
files: files,
pathMapping: pathMappingObj,
});
@ -153,7 +161,9 @@ export function setup(
}
}
function runOneBuildImpl(): boolean { return runOneBuild(['@' + tsConfigJsonPath]); }
function runOneBuildImpl(): boolean {
return runOneBuild(['@' + tsConfigJsonPath]);
}
}
function makeTempDir(baseDir: string): string {