Skip to content

Commit dfd8140

Browse files
bowennialxhub
authored andcommitted
Fix format
1 parent 6ea3ab7 commit dfd8140

2 files changed

Lines changed: 24 additions & 10 deletions

File tree

modules/@angular/compiler-cli/src/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ function codegen(
2222
return CodeGenerator.create(ngOptions, cliOptions, program, host).codegen();
2323
}
2424

25-
export function main(args: any, consoleError: (s: string) => void = console.error): Promise<number> {
25+
export function main(
26+
args: any, consoleError: (s: string) => void = console.error): Promise<number> {
2627
const project = args.p || args.project || '.';
2728
const cliOptions = new tsc.NgcCliOptions(args);
2829

@@ -42,4 +43,4 @@ export function main(args: any, consoleError: (s: string) => void = console.erro
4243
if (require.main === module) {
4344
const args = require('minimist')(process.argv.slice(2));
4445
main(args).then((exitCode: number) => process.exit(exitCode));
45-
}
46+
}

modules/@angular/compiler-cli/test/main_spec.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ describe('compiler-cli', () => {
6464

6565
main({p: basePath}, mockConsole.error)
6666
.then((exitCode) => {
67-
expect(mockConsole.error).toHaveBeenCalledWith(`Error File '` + path.join(basePath, 'test.ts') + `' not found.`);
67+
expect(mockConsole.error)
68+
.toHaveBeenCalledWith(
69+
`Error File '` + path.join(basePath, 'test.ts') + `' not found.`);
6870
expect(mockConsole.error).not.toHaveBeenCalledWith('Compilation failed');
6971
expect(exitCode).toEqual(1);
7072
done();
@@ -81,7 +83,9 @@ describe('compiler-cli', () => {
8183

8284
main({p: basePath}, mockConsole.error)
8385
.then((exitCode) => {
84-
expect(mockConsole.error).toHaveBeenCalledWith('Error at ' + path.join(basePath, 'test.ts') + `:1:1: Cannot find name 'foo'.`);
86+
expect(mockConsole.error)
87+
.toHaveBeenCalledWith(
88+
'Error at ' + path.join(basePath, 'test.ts') + `:1:1: Cannot find name 'foo'.`);
8589
expect(mockConsole.error).not.toHaveBeenCalledWith('Compilation failed');
8690
expect(exitCode).toEqual(1);
8791
done();
@@ -90,15 +94,18 @@ describe('compiler-cli', () => {
9094
});
9195

9296
it('should not print the stack trace if cannot find the imported module', (done) => {
93-
write('test.ts', "import {MyClass} from './not-exist-deps';");
97+
write('test.ts', `import {MyClass} from './not-exist-deps';`);
9498

9599
const mockConsole = {error: (s: string) => {}};
96100

97101
spyOn(mockConsole, 'error');
98102

99103
main({p: basePath}, mockConsole.error)
100104
.then((exitCode) => {
101-
expect(mockConsole.error).toHaveBeenCalledWith('Error at ' + path.join(basePath, 'test.ts') + `:1:23: Cannot find module './not-exist-deps'.`);
105+
expect(mockConsole.error)
106+
.toHaveBeenCalledWith(
107+
'Error at ' + path.join(basePath, 'test.ts') +
108+
`:1:23: Cannot find module './not-exist-deps'.`);
102109
expect(mockConsole.error).not.toHaveBeenCalledWith('Compilation failed');
103110
expect(exitCode).toEqual(1);
104111
done();
@@ -108,15 +115,18 @@ describe('compiler-cli', () => {
108115

109116
it('should not print the stack trace if cannot import', (done) => {
110117
write('empty-deps.ts', 'export const A = 1;');
111-
write('test.ts', "import {MyClass} from './empty-deps';");
118+
write('test.ts', `import {MyClass} from './empty-deps';`);
112119

113120
const mockConsole = {error: (s: string) => {}};
114121

115122
spyOn(mockConsole, 'error');
116123

117124
main({p: basePath}, mockConsole.error)
118125
.then((exitCode) => {
119-
expect(mockConsole.error).toHaveBeenCalledWith('Error at ' + path.join(basePath, 'test.ts') + `:1:9: Module '"` + path.join(basePath, 'empty-deps') + `"' has no exported member 'MyClass'.`);
126+
expect(mockConsole.error)
127+
.toHaveBeenCalledWith(
128+
'Error at ' + path.join(basePath, 'test.ts') + `:1:9: Module '"` +
129+
path.join(basePath, 'empty-deps') + `"' has no exported member 'MyClass'.`);
120130
expect(mockConsole.error).not.toHaveBeenCalledWith('Compilation failed');
121131
expect(exitCode).toEqual(1);
122132
done();
@@ -137,7 +147,10 @@ describe('compiler-cli', () => {
137147

138148
main({p: basePath}, mockConsole.error)
139149
.then((exitCode) => {
140-
expect(mockConsole.error).toHaveBeenCalledWith('Error at ' + path.join(basePath, 'test.ts') + ':3:7: Cannot invoke an expression whose type lacks a call signature.');
150+
expect(mockConsole.error)
151+
.toHaveBeenCalledWith(
152+
'Error at ' + path.join(basePath, 'test.ts') +
153+
':3:7: Cannot invoke an expression whose type lacks a call signature.');
141154
expect(mockConsole.error).not.toHaveBeenCalledWith('Compilation failed');
142155
expect(exitCode).toEqual(1);
143156
done();
@@ -161,4 +174,4 @@ describe('compiler-cli', () => {
161174
})
162175
.catch(e => done.fail(e));
163176
});
164-
});
177+
});

0 commit comments

Comments
 (0)