Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ import { AppModule } from './app/app<%= typeSeparator %>module';
platformBrowser().bootstrapModule(AppModule, {
<% if (!!viewEncapsulation) { %> defaultEncapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } %>
})
.catch(err => console.error(err));
.catch((err: unknown) => {
console.error(err);
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ import { appConfig } from './app/app.config';
import { App } from './app/app<%= suffix %>';

bootstrapApplication(App, appConfig)
.catch((err) => console.error(err));
.catch((err: unknown) => {
console.error(err);
});
15 changes: 9 additions & 6 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,13 +696,16 @@ describe('Application Schematic', () => {
expect(config).toContain('provideRouter(routes)');
});

it('should create a main.ts', async () => {
const options = { ...defaultOptions, standalone: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
for (const standalone of [true, false]) {
it(`should create a main.ts with an unknown catch parameter and a block body (standalone=${standalone})`, async () => {
const options = { ...defaultOptions, standalone };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);

const main = tree.readContent('/projects/foo/src/main.ts');
expect(main).toContain('bootstrapApplication');
});
const main = tree.readContent('/projects/foo/src/main.ts');
expect(main).toContain(standalone ? 'bootstrapApplication' : 'bootstrapModule');
expect(main).toMatch(/\.catch\(\(err: unknown\) => \{\s+console\.error\(err\);\s+\}\);/);
});
}

describe('standalone=false', () => {
it('should add the provideZoneChangeDetection with event coalescing option by default with zone.js apps', async () => {
Expand Down
Loading