Skip to content

Commit 8bdf1a8

Browse files
jbedarddgp1130
authored andcommitted
build: run prettier on legacy-cli e2e files
1 parent 3ab1142 commit 8bdf1a8

File tree

123 files changed

+1380
-1096
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1380
-1096
lines changed

tests/legacy-cli/e2e/setup/100-global-cli.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getGlobalVariable } from '../utils/env';
22
import { exec, silentNpm } from '../utils/process';
33

4-
export default async function() {
4+
export default async function () {
55
const argv = getGlobalVariable('argv');
66
if (argv.noglobal) {
77
return;
@@ -10,12 +10,7 @@ export default async function() {
1010
const testRegistry = getGlobalVariable('package-registry');
1111

1212
// Install global Angular CLI.
13-
await silentNpm(
14-
'install',
15-
'--global',
16-
'@angular/cli',
17-
`--registry=${testRegistry}`,
18-
);
13+
await silentNpm('install', '--global', '@angular/cli', `--registry=${testRegistry}`);
1914

2015
try {
2116
await exec(process.platform.startsWith('win') ? 'where' : 'which', 'ng');

tests/legacy-cli/e2e/setup/200-create-tmp-dir.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { tmpdir } from 'os';
33
import { dirname, join } from 'path';
44
import { getGlobalVariable, setGlobalVariable } from '../utils/env';
55

6-
export default function() {
6+
export default function () {
77
const argv = getGlobalVariable('argv');
88

99
// Get to a temporary directory.

tests/legacy-cli/e2e/setup/300-log-environment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { ng, node, npm } from '../utils/process';
22

3-
export default async function() {
3+
export default async function () {
44
console.log('Environment:');
55

6-
Object.keys(process.env).forEach(envName => {
6+
Object.keys(process.env).forEach((envName) => {
77
// CI Logs should not contain environment variables that are considered secret
88
const lowerName = envName.toLowerCase();
99
if (lowerName.includes('key') || lowerName.includes('secret')) {

tests/legacy-cli/e2e/tests/basic/aot.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { ng } from '../../utils/process';
33

44
export default async function () {
55
await ng('build', '--aot=true', '--configuration=development');
6-
await expectFileToMatch('dist/test-project/main.js',
7-
/platformBrowser.*bootstrapModule.*AppModule/);
6+
await expectFileToMatch(
7+
'dist/test-project/main.js',
8+
/platformBrowser.*bootstrapModule.*AppModule/,
9+
);
810
}

tests/legacy-cli/e2e/tests/basic/environment.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { expectFileToMatch } from '../../utils/fs';
22
import { ng } from '../../utils/process';
33
import { updateJsonFile } from '../../utils/project';
44

5-
65
export default async function () {
76
// Try a prod build.
8-
await updateJsonFile('angular.json', configJson => {
7+
await updateJsonFile('angular.json', (configJson) => {
98
const appArchitect = configJson.projects['test-project'].architect;
109
appArchitect.build.configurations['prod-env'] = {
1110
...appArchitect.build.configurations['development'],

tests/legacy-cli/e2e/tests/basic/in-project-logic.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ import { writeFile, deleteFile } from '../../utils/fs';
44
import { ng } from '../../utils/process';
55
import { expectToFail } from '../../utils/utils';
66

7-
8-
export default function() {
7+
export default function () {
98
const homedir = os.homedir();
109
const globalConfigPath = join(homedir, '.angular-config.json');
11-
return Promise.resolve()
12-
.then(() => writeFile(globalConfigPath, '{"version":1}'))
13-
.then(() => process.chdir(homedir))
14-
.then(() => ng('new', 'proj-name', '--dry-run'))
15-
.then(() => deleteFile(globalConfigPath))
16-
// Test that we cannot create a project inside another project.
17-
.then(() => writeFile(join(homedir, '.angular.json'), '{"version":1}'))
18-
.then(() => expectToFail(() => ng('new', 'proj-name', '--dry-run')))
19-
.then(() => deleteFile(join(homedir, '.angular.json')));
10+
return (
11+
Promise.resolve()
12+
.then(() => writeFile(globalConfigPath, '{"version":1}'))
13+
.then(() => process.chdir(homedir))
14+
.then(() => ng('new', 'proj-name', '--dry-run'))
15+
.then(() => deleteFile(globalConfigPath))
16+
// Test that we cannot create a project inside another project.
17+
.then(() => writeFile(join(homedir, '.angular.json'), '{"version":1}'))
18+
.then(() => expectToFail(() => ng('new', 'proj-name', '--dry-run')))
19+
.then(() => deleteFile(join(homedir, '.angular.json')))
20+
);
2021
}

tests/legacy-cli/e2e/tests/basic/size-tracking.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
import { appendToFile, moveDirectory, prependToFile, replaceInFile, writeFile } from '../../utils/fs';
1+
import {
2+
appendToFile,
3+
moveDirectory,
4+
prependToFile,
5+
replaceInFile,
6+
writeFile,
7+
} from '../../utils/fs';
28
import { ng } from '../../utils/process';
39

4-
510
export default async function () {
611
// Store the production build for artifact storage on CircleCI
712
if (process.env['CIRCLECI']) {
8-
913
// Add initial app routing.
1014
// This is done automatically on a new app with --routing but must be done manually on
1115
// existing apps.
1216
const appRoutingModulePath = 'src/app/app-routing.module.ts';
13-
await writeFile(appRoutingModulePath, `
17+
await writeFile(
18+
appRoutingModulePath,
19+
`
1420
import { NgModule } from '@angular/core';
1521
import { Routes, RouterModule } from '@angular/router';
1622
@@ -21,9 +27,12 @@ export default async function () {
2127
exports: [RouterModule]
2228
})
2329
export class AppRoutingModule { }
24-
`);
25-
await prependToFile('src/app/app.module.ts',
26-
`import { AppRoutingModule } from './app-routing.module';`);
30+
`,
31+
);
32+
await prependToFile(
33+
'src/app/app.module.ts',
34+
`import { AppRoutingModule } from './app-routing.module';`,
35+
);
2736
await replaceInFile('src/app/app.module.ts', `imports: [`, `imports: [ AppRoutingModule,`);
2837
await appendToFile('src/app/app.component.html', '<router-outlet></router-outlet>');
2938

tests/legacy-cli/e2e/tests/build/allow-js.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ import { ng } from '../../utils/process';
22
import { updateTsConfig } from '../../utils/project';
33
import { appendToFile, writeFile } from '../../utils/fs';
44

5-
export default async function() {
5+
export default async function () {
66
// TODO(architect): Delete this test. It is now in devkit/build-angular.
77

88
await writeFile('src/my-js-file.js', 'console.log(1); export const a = 2;');
9-
await appendToFile('src/main.ts', `
9+
await appendToFile(
10+
'src/main.ts',
11+
`
1012
import { a } from './my-js-file';
1113
console.log(a);
12-
`);
14+
`,
15+
);
1316

14-
await updateTsConfig(json => {
17+
await updateTsConfig((json) => {
1518
json['compilerOptions'].allowJs = true;
1619
});
1720

tests/legacy-cli/e2e/tests/build/assets.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ export default async function () {
1616
await expectToFail(() => expectFileToExist('dist/test-project/assets/.gitkeep'));
1717

1818
// Ensure `followSymlinks` option follows symlinks
19-
await updateJsonFile('angular.json', workspaceJson => {
19+
await updateJsonFile('angular.json', (workspaceJson) => {
2020
const appArchitect = workspaceJson.projects['test-project'].architect;
21-
appArchitect['build'].options.assets = [{ glob: '**/*', input: 'src/assets', output: 'assets', followSymlinks: true }];
21+
appArchitect['build'].options.assets = [
22+
{ glob: '**/*', input: 'src/assets', output: 'assets', followSymlinks: true },
23+
];
2224
});
2325
fs.mkdirSync('dirToSymlink/subdir1', { recursive: true });
2426
fs.mkdirSync('dirToSymlink/subdir2/subsubdir1', { recursive: true });

tests/legacy-cli/e2e/tests/build/barrel-file.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { replaceInFile, writeFile } from '../../utils/fs';
22
import { ng } from '../../utils/process';
33

4-
export default async function() {
4+
export default async function () {
55
await writeFile('src/app/index.ts', `export { AppModule } from './app.module';`);
66
await replaceInFile('src/main.ts', './app/app.module', './app');
77
await ng('build', '--configuration=development');
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ng } from '../../utils/process';
22
import { expectFileToMatch } from '../../utils/fs';
33

4-
5-
export default function() {
4+
export default function () {
65
// TODO(architect): Delete this test. It is now in devkit/build-angular.
76

8-
return ng('build', '--base-href', '/myUrl', '--configuration=development')
9-
.then(() => expectFileToMatch('dist/test-project/index.html', /<base href="\/myUrl">/));
7+
return ng('build', '--base-href', '/myUrl', '--configuration=development').then(() =>
8+
expectFileToMatch('dist/test-project/index.html', /<base href="\/myUrl">/),
9+
);
1010
}

tests/legacy-cli/e2e/tests/build/build-errors.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const extraErrors = [
1010
`main.ts is not part of the TypeScript compilation.`,
1111
];
1212

13-
export default function() {
13+
export default function () {
1414
// TODO(architect): Delete this test. It is now in devkit/build-angular.
1515

1616
if (process.platform.startsWith('win')) {
@@ -28,11 +28,11 @@ export default function() {
2828
Promise.resolve()
2929
// Save the original contents of `./src/app/app.component.ts`.
3030
.then(() => readFile('./src/app/app.component.ts'))
31-
.then(contents => (origContent = contents))
31+
.then((contents) => (origContent = contents))
3232
// Check `part of the TypeScript compilation` errors.
3333
// These should show an error only for the missing file.
3434
.then(() =>
35-
updateJsonFile('./tsconfig.app.json', configJson => {
35+
updateJsonFile('./tsconfig.app.json', (configJson) => {
3636
(configJson.include = undefined), (configJson.files = ['src/main.ts']);
3737
}),
3838
)
@@ -41,12 +41,12 @@ export default function() {
4141
if (!message.includes('polyfills.ts is missing from the TypeScript compilation')) {
4242
throw new Error(`Expected missing TS file error, got this instead:\n${message}`);
4343
}
44-
if (extraErrors.some(e => message.includes(e))) {
44+
if (extraErrors.some((e) => message.includes(e))) {
4545
throw new Error(`Did not expect extra errors but got:\n${message}`);
4646
}
4747
})
4848
.then(() =>
49-
updateJsonFile('./tsconfig.app.json', configJson => {
49+
updateJsonFile('./tsconfig.app.json', (configJson) => {
5050
configJson.include = ['src/**/*.ts'];
5151
configJson.exclude = ['**/**.spec.ts'];
5252
configJson.files = undefined;
@@ -60,7 +60,7 @@ export default function() {
6060
if (!message.includes('Declaration or statement expected.')) {
6161
throw new Error(`Expected syntax error, got this instead:\n${message}`);
6262
}
63-
if (extraErrors.some(e => message.includes(e))) {
63+
if (extraErrors.some((e) => message.includes(e))) {
6464
throw new Error(`Did not expect extra errors but got:\n${message}`);
6565
}
6666
})
@@ -76,10 +76,10 @@ export default function() {
7676
) {
7777
throw new Error(`Expected static analysis error, got this instead:\n${message}`);
7878
}
79-
if (extraErrors.some(e => message.includes(e))) {
79+
if (extraErrors.some((e) => message.includes(e))) {
8080
throw new Error(`Did not expect extra errors but got:\n${message}`);
8181
}
8282
})
8383
.then(() => writeFile('./src/app/app.component.ts', origContent))
8484
);
85-
}
85+
}

tests/legacy-cli/e2e/tests/build/build-optimizer.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ import { ng } from '../../utils/process';
22
import { expectFileToMatch, expectFileToExist } from '../../utils/fs';
33
import { expectToFail } from '../../utils/utils';
44

5-
65
export default function () {
76
// TODO(architect): Delete this test. It is now in devkit/build-angular.
87

98
return ng('build', '--aot', '--build-optimizer')
10-
.then(() => expectToFail(() => expectFileToMatch('dist/test-project/main.js', /\.decorators =/)))
9+
.then(() =>
10+
expectToFail(() => expectFileToMatch('dist/test-project/main.js', /\.decorators =/)),
11+
)
1112
.then(() => ng('build'))
1213
.then(() => expectToFail(() => expectFileToExist('dist/vendor.js')))
13-
.then(() => expectToFail(() => expectFileToMatch('dist/test-project/main.js', /\.decorators =/)))
14+
.then(() =>
15+
expectToFail(() => expectFileToMatch('dist/test-project/main.js', /\.decorators =/)),
16+
)
1417
.then(() => expectToFail(() => ng('build', '--aot=false', '--build-optimizer')));
1518
}

tests/legacy-cli/e2e/tests/build/bundle-budgets.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { expectToFail } from '../../utils/utils';
1111

1212
export default async function () {
1313
// Error
14-
await updateJsonFile('angular.json', json => {
14+
await updateJsonFile('angular.json', (json) => {
1515
json.projects['test-project'].architect.build.configurations.production.budgets = [
1616
{ type: 'all', maximumError: '100b' },
1717
];
@@ -23,7 +23,7 @@ export default async function () {
2323
}
2424

2525
// Warning
26-
await updateJsonFile('angular.json', json => {
26+
await updateJsonFile('angular.json', (json) => {
2727
json.projects['test-project'].architect.build.configurations.production.budgets = [
2828
{ type: 'all', minimumWarning: '100mb' },
2929
];
@@ -35,7 +35,7 @@ export default async function () {
3535
}
3636

3737
// Pass
38-
await updateJsonFile('angular.json', json => {
38+
await updateJsonFile('angular.json', (json) => {
3939
json.projects['test-project'].architect.build.configurations.production.budgets = [
4040
{ type: 'allScript', maximumError: '100mb' },
4141
];

0 commit comments

Comments
 (0)