refactor: apply prettier formatting to integration (#54653)

Apply prettier formatting to integration directories

PR Close #54653
This commit is contained in:
Joey Perrott
2024-02-28 16:45:43 +00:00
committed by Jessica Janiuk
parent ade024407d
commit 894c1c5f10
153 changed files with 916 additions and 754 deletions
+1
View File
@@ -9,6 +9,7 @@ export const format: FormatConfig = {
'**/*.{yaml,yml}',
'adev/**/*.{js,ts}',
'devtools/**/*.{js,ts}',
'integration/**/*.{js,ts}',
'tools/**/*.{js,ts}',
'modules/**/*.{js,ts}',
'scripts/**/*.{js,ts}',
+13 -6
View File
@@ -10,15 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/latest-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -29,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
@@ -6,5 +6,4 @@ import {RouterModule} from '@angular/router';
imports: [RouterModule],
standalone: true,
})
export class AppComponent {
}
export class AppComponent {}
@@ -3,19 +3,13 @@ import {Component} from '@angular/core';
@Component({
selector: 'app-open-close',
animations: [
trigger(
'openClose',
[
// ...
state(
'open',
style({height: '200px', opacity: 1, backgroundColor: 'yellow'})),
state(
'closed',
style({height: '100px', opacity: 0.8, backgroundColor: 'blue'})),
transition('open => closed', [animate('1s')]),
transition('closed => open', [animate('0.5s')]),
]),
trigger('openClose', [
// ...
state('open', style({height: '200px', opacity: 1, backgroundColor: 'yellow'})),
state('closed', style({height: '100px', opacity: 0.8, backgroundColor: 'blue'})),
transition('open => closed', [animate('1s')]),
transition('closed => open', [animate('0.5s')]),
]),
],
template: `<nav>
<button type="button" (click)="toggle()">Toggle Open/Close</button>
@@ -24,7 +18,8 @@ import {Component} from '@angular/core';
<div [@openClose]="isOpen ? 'open' : 'closed'" class="open-close-container">
<p>The box is now {{ isOpen ? 'Open' : 'Closed' }}!</p>
</div>`,
styles: [`:host {
styles: [
`:host {
display: block;
margin-top: 1rem;
}
@@ -36,7 +31,8 @@ import {Component} from '@angular/core';
color: #000000;
font-weight: bold;
font-size: 20px;
}`],
}`,
],
standalone: true,
})
export class OpenCloseComponent {
@@ -45,4 +41,4 @@ export class OpenCloseComponent {
toggle() {
this.isOpen = !this.isOpen;
}
}
}
+13 -6
View File
@@ -10,15 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/latest-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -29,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
@@ -6,5 +6,4 @@ import {RouterModule} from '@angular/router';
imports: [RouterModule],
standalone: true,
})
export class AppComponent {
}
export class AppComponent {}
@@ -3,19 +3,13 @@ import {Component} from '@angular/core';
@Component({
selector: 'app-open-close',
animations: [
trigger(
'openClose',
[
// ...
state(
'open',
style({height: '200px', opacity: 1, backgroundColor: 'yellow'})),
state(
'closed',
style({height: '100px', opacity: 0.8, backgroundColor: 'blue'})),
transition('open => closed', [animate('1s')]),
transition('closed => open', [animate('0.5s')]),
]),
trigger('openClose', [
// ...
state('open', style({height: '200px', opacity: 1, backgroundColor: 'yellow'})),
state('closed', style({height: '100px', opacity: 0.8, backgroundColor: 'blue'})),
transition('open => closed', [animate('1s')]),
transition('closed => open', [animate('0.5s')]),
]),
],
template: `<nav>
<button type="button" (click)="toggle()">Toggle Open/Close</button>
@@ -24,7 +18,8 @@ import {Component} from '@angular/core';
<div [@openClose]="isOpen ? 'open' : 'closed'" class="open-close-container">
<p>The box is now {{ isOpen ? 'Open' : 'Closed' }}!</p>
</div>`,
styles: [`:host {
styles: [
`:host {
display: block;
margin-top: 1rem;
}
@@ -36,7 +31,8 @@ import {Component} from '@angular/core';
color: #000000;
font-weight: bold;
font-size: 20px;
}`],
}`,
],
standalone: true,
})
export class OpenCloseComponent {
@@ -45,4 +41,4 @@ export class OpenCloseComponent {
toggle() {
this.isOpen = !this.isOpen;
}
}
}
+15 -11
View File
@@ -55,25 +55,29 @@ const nonExactDeps = deps.filter(([, version]) => !/^\d+\.\d+\.\d+(?:-\w+\.\d+)?
if (nonExactDeps.length) {
throw new Error(
`The following dependencies in '${projectDir}' are not pinned to exact versions (of the ` +
`The following dependencies in '${projectDir}' are not pinned to exact versions (of the ` +
'format X.Y.Z[-<pre-release-identifier>]):' +
nonExactDeps.map(([name, version]) => `\n ${name}: ${version}`));
nonExactDeps.map(([name, version]) => `\n ${name}: ${version}`),
);
}
// Check for dependencies that are not in-sync between `package.json` and the lockfile.
const {object: parsedLockfile} = parseLockfile(readFileSync(lockfilePath, 'utf8'));
const outOfSyncDeps = deps
.map(([depName, pkgJsonVersion]) => [
depName,
pkgJsonVersion,
(parsedLockfile[`${depName}@${pkgJsonVersion}`] || {}).version,
])
.filter(([, pkgJsonVersion, lockfileVersion]) => pkgJsonVersion !== lockfileVersion);
.map(([depName, pkgJsonVersion]) => [
depName,
pkgJsonVersion,
(parsedLockfile[`${depName}@${pkgJsonVersion}`] || {}).version,
])
.filter(([, pkgJsonVersion, lockfileVersion]) => pkgJsonVersion !== lockfileVersion);
if (outOfSyncDeps.length) {
throw new Error(
`The following dependencies in '${projectDir}' are out-of-sync between 'package.json' and ` +
`The following dependencies in '${projectDir}' are out-of-sync between 'package.json' and ` +
'the lockfile:' +
outOfSyncDeps.map(([name, pkgJsonVersion, lockfileVersion]) =>
`\n ${name}: ${pkgJsonVersion} vs ${lockfileVersion}`));
outOfSyncDeps.map(
([name, pkgJsonVersion, lockfileVersion]) =>
`\n ${name}: ${pkgJsonVersion} vs ${lockfileVersion}`,
),
);
}
@@ -2,23 +2,28 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');
const {SpecReporter, StacktraceOption} = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
@@ -28,16 +33,18 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY
}
}));
}
jasmine.getEnv().addReporter(
new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY,
},
}),
);
},
};
@@ -1,5 +1,5 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
import {AppPage} from './app.po';
import {browser, logging} from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
@@ -1,4 +1,4 @@
import { browser, by, element } from 'protractor';
import {browser, by, element} from 'protractor';
export class AppPage {
async navigateTo(): Promise<unknown> {
@@ -10,18 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/cli-elements-universal'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
],
reporters: [{type: 'html'}, {type: 'text-summary'}],
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -32,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
@@ -1,19 +1,14 @@
import { Component, Input } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import {Component, Input} from '@angular/core';
import {TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {RouterModule} from '@angular/router';
import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
TestBed.configureTestingModule({
declarations: [
AppComponent,
TestTitleComponent,
],
imports: [
RouterModule.forRoot([]),
],
declarations: [AppComponent, TestTitleComponent],
imports: [RouterModule.forRoot([])],
});
await TestBed.compileComponents();
});
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import {Component} from '@angular/core';
@Component({
selector: 'app-root',
@@ -1,27 +1,17 @@
import { isPlatformBrowser } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, Inject, Injector, NgModule, PLATFORM_ID } from '@angular/core';
import { createCustomElement } from '@angular/elements';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import {isPlatformBrowser} from '@angular/common';
import {CUSTOM_ELEMENTS_SCHEMA, Inject, Injector, NgModule, PLATFORM_ID} from '@angular/core';
import {createCustomElement} from '@angular/elements';
import {BrowserModule} from '@angular/platform-browser';
import {RouterModule} from '@angular/router';
import { AppComponent } from './app.component';
import { TitleComponent } from './title.component';
import {AppComponent} from './app.component';
import {TitleComponent} from './title.component';
@NgModule({
bootstrap: [
AppComponent,
],
declarations: [
AppComponent,
TitleComponent,
],
imports: [
BrowserModule,
RouterModule.forRoot([]),
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
],
bootstrap: [AppComponent],
declarations: [AppComponent, TitleComponent],
imports: [BrowserModule, RouterModule.forRoot([])],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {
constructor(injector: Injector, @Inject(PLATFORM_ID) platformId: object) {
@@ -1,18 +1,12 @@
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { RouterModule } from '@angular/router';
import {NgModule} from '@angular/core';
import {ServerModule} from '@angular/platform-server';
import {RouterModule} from '@angular/router';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
import {AppModule} from './app.module';
import {AppComponent} from './app.component';
@NgModule({
bootstrap: [
AppComponent,
],
imports: [
AppModule,
RouterModule.forRoot([]),
ServerModule,
],
bootstrap: [AppComponent],
imports: [AppModule, RouterModule.forRoot([]), ServerModule],
})
export class AppServerModule {}
@@ -1,5 +1,5 @@
import { TestBed } from '@angular/core/testing';
import { TitleComponent } from './title.component';
import {TestBed} from '@angular/core/testing';
import {TitleComponent} from './title.component';
describe('TitleComponent', () => {
beforeEach(async () => {
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import {Component, Input} from '@angular/core';
@Component({
selector: 'app-title',
@@ -1,3 +1,3 @@
import '@angular/platform-server/init';
export { AppServerModule } from './app/app.server.module';
export {AppServerModule} from './app/app.server.module';
@@ -1,8 +1,9 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import {AppModule} from './app/app.module';
document.addEventListener('DOMContentLoaded', () => {
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
});
@@ -1,9 +1,15 @@
import {browser, by, element} from 'protractor';
export class AppPage {
navigateTo() { return browser.get('/'); }
navigateTo() {
return browser.get('/');
}
getHeading() { return element(by.css('app-root h1')).getText(); }
getHeading() {
return element(by.css('app-root h1')).getText();
}
getParagraph(name: string) { return element(by.css('app-root p#' + name)).getText(); }
getParagraph(name: string) {
return element(by.css('app-root p#' + name)).getText();
}
}
@@ -12,7 +12,9 @@ describe('cli-hello-world-ivy App', () => {
expect(page.getHeading()).toEqual('Hallo cli-hello-world-ivy-i18n!');
});
it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('de'); });
it('should display the locale', () => {
expect(page.getParagraph('locale')).toEqual('de');
});
it('the date pipe should show the localized month', () => {
page.navigateTo();
@@ -22,8 +24,10 @@ describe('cli-hello-world-ivy App', () => {
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry),
);
});
});
@@ -8,10 +8,13 @@ describe('cli-hello-world-ivy App', () => {
page.navigateTo();
});
it('should display title',
() => { expect(page.getHeading()).toEqual('Hello cli-hello-world-ivy-i18n!'); });
it('should display title', () => {
expect(page.getHeading()).toEqual('Hello cli-hello-world-ivy-i18n!');
});
it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('en-US'); });
it('should display the locale', () => {
expect(page.getParagraph('locale')).toEqual('en-US');
});
it('the date pipe should show the localized month', () => {
page.navigateTo();
@@ -21,8 +24,10 @@ describe('cli-hello-world-ivy App', () => {
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry),
);
});
});
@@ -8,10 +8,13 @@ describe('cli-hello-world-ivy App', () => {
page.navigateTo();
});
it('should display title',
() => { expect(page.getHeading()).toEqual('Bonjour cli-hello-world-ivy-i18n!'); });
it('should display title', () => {
expect(page.getHeading()).toEqual('Bonjour cli-hello-world-ivy-i18n!');
});
it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('fr'); });
it('should display the locale', () => {
expect(page.getParagraph('locale')).toEqual('fr');
});
it('the date pipe should show the localized month', () => {
page.navigateTo();
@@ -21,8 +24,10 @@ describe('cli-hello-world-ivy App', () => {
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry),
);
});
});
@@ -1,24 +1,29 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
const {SpecReporter} = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
@@ -26,12 +31,12 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
},
};
@@ -10,15 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/latest-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -29,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
@@ -3,11 +3,9 @@ import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed
.configureTestingModule({
declarations: [AppComponent],
})
.compileComponents();
TestBed.configureTestingModule({
declarations: [AppComponent],
}).compileComponents();
}));
it('should create the app', () => {
@@ -26,7 +24,6 @@ describe('AppComponent', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent)
.toContain('Hello cli-hello-world-ivy-i18n!');
expect(compiled.querySelector('h1').textContent).toContain('Hello cli-hello-world-ivy-i18n!');
});
});
@@ -1,11 +1,11 @@
import { Component, Inject, LOCALE_ID } from '@angular/core';
import {Component, Inject, LOCALE_ID} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
templateUrl: './app.component.html',
})
export class AppComponent {
constructor(@Inject(LOCALE_ID) public locale: string) { }
constructor(@Inject(LOCALE_ID) public locale: string) {}
title = `cli-hello-world-ivy-i18n`;
jan = new Date(2000, 0, 1);
}
@@ -9,5 +9,4 @@ import {AppComponent} from './app.component';
registerLocaleData(localeFr);
@NgModule({declarations: [AppComponent], imports: [BrowserModule], bootstrap: [AppComponent]})
export class AppModule {
}
export class AppModule {}
@@ -1,3 +1,3 @@
export const environment = {
production: true
production: true,
};
@@ -3,7 +3,7 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
};
/*
@@ -1,6 +1,7 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import {AppModule} from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
@@ -4,12 +4,15 @@ const path = require('path');
const distPath = './dist/';
const ngDevModeVariable = 'ngDevMode';
const filesWithNgDevMode = fs.readdirSync(distPath)
.filter(p => p.endsWith('.js'))
.filter(p => fs.readFileSync(path.join(distPath, p), 'utf-8').includes(ngDevModeVariable));
const filesWithNgDevMode = fs
.readdirSync(distPath)
.filter((p) => p.endsWith('.js'))
.filter((p) => fs.readFileSync(path.join(distPath, p), 'utf-8').includes(ngDevModeVariable));
if (filesWithNgDevMode.length > 0) {
throw new Error(`Found '${ngDevModeVariable}' referenced in ${filesWithNgDevMode}. These references should be tree-shaken away!`);
throw new Error(
`Found '${ngDevModeVariable}' referenced in ${filesWithNgDevMode}. These references should be tree-shaken away!`,
);
} else {
console.log(`No '${ngDevModeVariable}' references found in ${distPath}`)
console.log(`No '${ngDevModeVariable}' references found in ${distPath}`);
}
@@ -1,23 +1,28 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
const {SpecReporter} = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
@@ -26,12 +31,12 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
},
};
@@ -1,5 +1,5 @@
import { AppPage } from './app.po';
import { browser, logging, element, by } from 'protractor';
import {AppPage} from './app.po';
import {browser, logging, element, by} from 'protractor';
describe('cli-hello-world-lazy App', () => {
let page: AppPage;
@@ -21,8 +21,10 @@ describe('cli-hello-world-lazy App', () => {
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry),
);
});
});
@@ -1,4 +1,4 @@
import { browser, by, element } from 'protractor';
import {browser, by, element} from 'protractor';
export class AppPage {
navigateTo() {
+13 -6
View File
@@ -10,15 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/cli-hello-world-lazy'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -29,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
@@ -3,11 +3,9 @@ import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(waitForAsync(() => {
TestBed
.configureTestingModule({
imports: [AppComponent],
})
.compileComponents();
TestBed.configureTestingModule({
imports: [AppComponent],
}).compileComponents();
}));
it('should create the app', () => {
@@ -26,7 +24,8 @@ describe('AppComponent', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('.content span').textContent)
.toContain('cli-hello-world-lazy app is running!');
expect(compiled.querySelector('.content span').textContent).toContain(
'cli-hello-world-lazy app is running!',
);
});
});
@@ -1,7 +1,8 @@
import {Routes} from '@angular/router';
export const appRoutes: Routes = [{
path: 'lazy',
loadChildren: () => import('./lazy/lazy.routes').then(routes => routes.lazyRoutes),
}];
export const appRoutes: Routes = [
{
path: 'lazy',
loadChildren: () => import('./lazy/lazy.routes').then((routes) => routes.lazyRoutes),
},
];
@@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { LazyComponent } from './lazy.component';
import {LazyComponent} from './lazy.component';
describe('LazyComponent', () => {
let component: LazyComponent;
@@ -8,9 +8,8 @@ describe('LazyComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LazyComponent ]
})
.compileComponents();
declarations: [LazyComponent],
}).compileComponents();
}));
beforeEach(() => {
@@ -5,5 +5,4 @@ import {Component} from '@angular/core';
selector: 'app-lazy',
template: '<p>lazy works!</p>',
})
export class LazyComponent {
}
export class LazyComponent {}
+1 -4
View File
@@ -5,8 +5,5 @@ import {AppComponent} from './app/app.component';
import {appRoutes} from './app/app.routes';
bootstrapApplication(AppComponent, {
providers: [
provideRouter(appRoutes),
provideProtractorTestingSupport(),
]
providers: [provideRouter(appRoutes), provideProtractorTestingSupport()],
}).catch(console.error);
@@ -1,23 +1,28 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
const {SpecReporter} = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
@@ -26,12 +31,12 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
},
};
@@ -1,5 +1,5 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
import {AppPage} from './app.po';
import {browser, logging} from 'protractor';
describe('cli-hello-world App', () => {
let page: AppPage;
@@ -16,8 +16,10 @@ describe('cli-hello-world App', () => {
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry),
);
});
});
@@ -1,4 +1,4 @@
import { browser, by, element } from 'protractor';
import {browser, by, element} from 'protractor';
export class AppPage {
navigateTo() {
@@ -5,11 +5,9 @@ import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(waitForAsync(() => {
TestBed
.configureTestingModule({
declarations: [AppComponent],
})
.compileComponents();
TestBed.configureTestingModule({
declarations: [AppComponent],
}).compileComponents();
}));
it('should create the app', () => {
@@ -28,7 +26,8 @@ describe('AppComponent', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('.content span').textContent)
.to.include('cli-hello-world app is running!');
expect(compiled.querySelector('.content span').textContent).to.include(
'cli-hello-world app is running!',
);
});
});
@@ -1,9 +1,9 @@
import { Component } from '@angular/core';
import {Component} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
styleUrls: ['./app.component.css'],
})
export class AppComponent {
title = 'cli-hello-world';
@@ -1,21 +1,17 @@
import { BrowserModule } from '@angular/platform-browser';
import { LOCALE_ID, NgModule } from '@angular/core';
import { registerLocaleData } from '@angular/common';
import {BrowserModule} from '@angular/platform-browser';
import {LOCALE_ID, NgModule} from '@angular/core';
import {registerLocaleData} from '@angular/common';
import localeFr from '@angular/common/locales/fr';
import { AppComponent } from './app.component';
import {AppComponent} from './app.component';
// adding this code to detect issues like https://github.com/angular/angular-cli/issues/10322
registerLocaleData(localeFr);
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [{ provide: LOCALE_ID, useValue: 'fr' }],
bootstrap: [AppComponent]
declarations: [AppComponent],
imports: [BrowserModule],
providers: [{provide: LOCALE_ID, useValue: 'fr'}],
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
@@ -1,6 +1,7 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import {AppModule} from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
@@ -1,23 +1,28 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
const {SpecReporter} = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
@@ -26,12 +31,12 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
},
};
@@ -1,5 +1,5 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
import {AppPage} from './app.po';
import {browser, logging} from 'protractor';
describe('cli-hello-world App', () => {
let page: AppPage;
@@ -16,8 +16,10 @@ describe('cli-hello-world App', () => {
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry),
);
});
});
@@ -1,4 +1,4 @@
import { browser, by, element } from 'protractor';
import {browser, by, element} from 'protractor';
export class AppPage {
navigateTo() {
+13 -6
View File
@@ -10,15 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/latest-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -29,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
@@ -3,11 +3,9 @@ import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(waitForAsync(() => {
TestBed
.configureTestingModule({
declarations: [AppComponent],
})
.compileComponents();
TestBed.configureTestingModule({
declarations: [AppComponent],
}).compileComponents();
}));
it('should create the app', () => {
@@ -26,7 +24,8 @@ describe('AppComponent', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('.content span').textContent)
.toContain('cli-hello-world app is running!');
expect(compiled.querySelector('.content span').textContent).toContain(
'cli-hello-world app is running!',
);
});
});
@@ -1,7 +1,10 @@
import {Component} from '@angular/core';
@Component(
{selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css']})
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
title = 'cli-hello-world';
}
@@ -1,21 +1,17 @@
import { BrowserModule } from '@angular/platform-browser';
import { LOCALE_ID, NgModule } from '@angular/core';
import { registerLocaleData } from '@angular/common';
import {BrowserModule} from '@angular/platform-browser';
import {LOCALE_ID, NgModule} from '@angular/core';
import {registerLocaleData} from '@angular/common';
import localeFr from '@angular/common/locales/fr';
import { AppComponent } from './app.component';
import {AppComponent} from './app.component';
// adding this code to detect issues like https://github.com/angular/angular-cli/issues/10322
registerLocaleData(localeFr);
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [{ provide: LOCALE_ID, useValue: 'fr' }],
bootstrap: [AppComponent]
declarations: [AppComponent],
imports: [BrowserModule],
providers: [{provide: LOCALE_ID, useValue: 'fr'}],
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
+5 -4
View File
@@ -1,6 +1,7 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import {AppModule} from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
@@ -1,23 +1,28 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
const {SpecReporter} = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
@@ -26,12 +31,12 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
},
};
@@ -32,8 +32,10 @@ describe('cli-signal-inputs App', () => {
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry),
);
});
});
+13 -6
View File
@@ -10,15 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/latest-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -29,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
@@ -22,7 +22,7 @@ import {GreetComponent} from './greet.component';
})
export class AppComponent {
firstName = 'John';
lastName: string|undefined = undefined;
lastName: string | undefined = undefined;
greets = viewChildren(GreetComponent);
}
@@ -15,7 +15,7 @@ import {Subject} from 'rxjs';
export class GreetComponent {
firstName = input.required<string>();
lastName = input(undefined, {
transform: (v?: string) => v === undefined ? 'transformed-fallback' : `ng-${v}`,
transform: (v?: string) => (v === undefined ? 'transformed-fallback' : `ng-${v}`),
});
@Input() decoratorInput = 0;
+14 -9
View File
@@ -1,23 +1,28 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
const {SpecReporter} = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
@@ -26,12 +31,12 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
},
};
+13 -6
View File
@@ -10,15 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/latest-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -29,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
+1 -2
View File
@@ -7,5 +7,4 @@ import {Component} from '@angular/core';
<h2>Defer-loaded component</h2>
`,
})
export class DeferComponent {
}
export class DeferComponent {}
+1 -1
View File
@@ -2,4 +2,4 @@ import {bootstrapApplication} from '@angular/platform-browser';
import {AppComponent} from './app/app.component';
bootstrapApplication(AppComponent);
bootstrapApplication(AppComponent);
@@ -1,4 +1,4 @@
import { AppPage } from './app.po';
import {AppPage} from './app.po';
describe('dynamic-compiler App', () => {
let page: AppPage;
+4 -1
View File
@@ -11,6 +11,9 @@ export class AppPage {
getLazyLoadedText() {
const el = element(by.css('app-root lazy-component'));
return browser.wait(protractor.ExpectedConditions.presenceOf(el)).then(() => el.getText(), err => el.getText());
return browser.wait(protractor.ExpectedConditions.presenceOf(el)).then(
() => el.getText(),
(err) => el.getText(),
);
}
}
@@ -1,21 +1,26 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
exports.config = {
specs: [
'../dist/e2e/*.e2e-spec.js'
],
specs: ['../dist/e2e/*.e2e-spec.js'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
// Port comes from lite-server config `/e2e/browser.config.json` `"port": 4201`
baseUrl: 'http://localhost:4201/',
framework: 'jasmine',
useAllAngular2AppRoots: true
useAllAngular2AppRoots: true,
};
@@ -13,7 +13,7 @@ export class AppComponent implements AfterViewInit {
constructor(private compiler: Compiler) {}
ngAfterViewInit() {
import('./lazy.module').then(module => {
import('./lazy.module').then((module) => {
this.compiler.compileModuleAndAllComponentsAsync(module.LazyModule).then((compiled) => {
const factory = compiled.componentFactories[0];
this.container.createComponent(factory);
@@ -1,8 +1,8 @@
import {Compiler, COMPILER_OPTIONS, CompilerFactory, NgModule} from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {BrowserModule} from '@angular/platform-browser';
import {JitCompilerFactory} from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
import {AppComponent} from './app.component';
export function createCompiler(compilerFactory: CompilerFactory) {
return compilerFactory.createCompiler();
@@ -15,8 +15,7 @@ export function createCompiler(compilerFactory: CompilerFactory) {
providers: [
{provide: COMPILER_OPTIONS, useValue: {}, multi: true},
{provide: CompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS]},
{provide: Compiler, useFactory: createCompiler, deps: [CompilerFactory]}
]
{provide: Compiler, useFactory: createCompiler, deps: [CompilerFactory]},
],
})
export class AppModule {}
@@ -3,15 +3,12 @@ import {NgModule, Component} from '@angular/core';
@Component({
selector: 'lazy-component',
template: 'Lazy-loaded component!',
jit: true
jit: true,
})
export class LazyComponent {
}
export class LazyComponent {}
@NgModule({
declarations: [LazyComponent],
jit: true,
})
export class LazyModule {
}
export class LazyModule {}
+3 -3
View File
@@ -1,7 +1,7 @@
import { enableProdMode } from '@angular/core';
import { platformBrowser } from '@angular/platform-browser';
import {enableProdMode} from '@angular/core';
import {platformBrowser} from '@angular/platform-browser';
import { AppModule } from './app.module';
import {AppModule} from './app.module';
enableProdMode();
+14 -9
View File
@@ -1,23 +1,28 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
const {SpecReporter} = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
@@ -26,12 +31,12 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
},
};
+5 -3
View File
@@ -17,8 +17,10 @@ describe('forms app', () => {
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry),
);
});
});
+13 -6
View File
@@ -10,15 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/latest-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -29,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
@@ -6,7 +6,7 @@ describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AppComponent, TemplateFormsComponent, ReactiveFormsComponent],
imports: [FormsModule, ReactiveFormsModule]
imports: [FormsModule, ReactiveFormsModule],
}).compileComponents();
});
+2 -3
View File
@@ -38,7 +38,7 @@ export class TemplateFormsComponent {
}
addCity() {
this.addresses.push(({city: ''}));
this.addresses.push({city: ''});
}
}
@@ -110,5 +110,4 @@ export class ReactiveFormsComponent {
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {
}
export class AppComponent {}
+4 -14
View File
@@ -6,18 +6,8 @@ import {BrowserModule} from '@angular/platform-browser';
import {AppComponent, ReactiveFormsComponent, TemplateFormsComponent} from './app.component';
@NgModule({
declarations: [
AppComponent,
TemplateFormsComponent,
ReactiveFormsComponent,
],
imports: [
BrowserModule,
CommonModule,
FormsModule,
ReactiveFormsModule,
],
bootstrap: [AppComponent]
declarations: [AppComponent, TemplateFormsComponent, ReactiveFormsComponent],
imports: [BrowserModule, CommonModule, FormsModule, ReactiveFormsModule],
bootstrap: [AppComponent],
})
export class AppModule {
}
export class AppModule {}
+5 -4
View File
@@ -1,6 +1,7 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import {AppModule} from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
+1 -5
View File
@@ -12,10 +12,6 @@ export class TestApp {}
@NgModule({
declarations: [TestApp],
bootstrap: [TestApp],
imports: [
Lib2Module,
BrowserModule,
ServerModule,
],
imports: [Lib2Module, BrowserModule, ServerModule],
})
export class AppModule {}
+12 -10
View File
@@ -13,14 +13,16 @@ enableProdMode();
renderModule(AppModule, {
document: '<test-app></test-app>',
url: '/',
}).then(html => {
if (/>0:0</.test(html)) {
process.exit(0);
} else {
console.error('html was', html);
process.exit(1);
}
}).catch(err => {
console.error(err);
process.exit(2);
})
.then((html) => {
if (/>0:0</.test(html)) {
process.exit(0);
} else {
console.error('html was', html);
process.exit(1);
}
})
.catch((err) => {
console.error(err);
process.exit(2);
});
+9 -3
View File
@@ -1,9 +1,15 @@
import {browser, by, element} from 'protractor';
export class AppPage {
navigateTo() { return browser.get('/'); }
navigateTo() {
return browser.get('/');
}
getHeading() { return element(by.css('app-root h1')).getText(); }
getHeading() {
return element(by.css('app-root h1')).getText();
}
getParagraph(name: string) { return element(by.css('app-root p#' + name)).getText(); }
getParagraph(name: string) {
return element(by.css('app-root p#' + name)).getText();
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ describe('cli-hello-world-ivy App', () => {
});
it('should display welcome message', () => {
expect(page.getParagraph('message')).toEqual('Bienvenue sur l\'application i18n. (inline)');
expect(page.getParagraph('message')).toEqual("Bienvenue sur l'application i18n. (inline)");
});
it('should display extra message', () => {
@@ -7,8 +7,9 @@ describe('cli-hello-world-ivy App', () => {
page.navigateTo();
});
it('should display translated title',
() => { expect(page.getHeading()).toEqual('Bonjour cli-hello-world-ivy-compat!'); });
it('should display translated title', () => {
expect(page.getHeading()).toEqual('Bonjour cli-hello-world-ivy-compat!');
});
it('should display untranslated welcome message', () => {
// This message does not get translated because we did not provide a translation for it
@@ -16,5 +17,7 @@ describe('cli-hello-world-ivy App', () => {
expect(page.getParagraph('message')).toEqual('Welcome to the i18n app.');
});
it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('legacy'); });
it('should display the locale', () => {
expect(page.getParagraph('locale')).toEqual('legacy');
});
});
+15 -10
View File
@@ -1,24 +1,29 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
const {SpecReporter} = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
chromeDriver: process.env.CHROMEDRIVER_BIN,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: process.env.CHROME_BIN,
// See /integration/README.md#browser-tests for more info on these args
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
args: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
@@ -26,12 +31,12 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
},
};
@@ -3,7 +3,9 @@ import {AppPage} from '../app.po';
describe('cli-hello-world-ivy App', () => {
let page: AppPage;
beforeEach(() => { page = new AppPage(); });
beforeEach(() => {
page = new AppPage();
});
it('should display title', () => {
page.navigateTo();
@@ -12,7 +14,7 @@ describe('cli-hello-world-ivy App', () => {
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraph('message')).toEqual('Bienvenue sur l\'application i18n.');
expect(page.getParagraph('message')).toEqual("Bienvenue sur l'application i18n.");
});
it('the percent pipe should work', () => {
@@ -20,7 +22,9 @@ describe('cli-hello-world-ivy App', () => {
expect(page.getParagraph('pipe')).toEqual('100 % awesome');
});
it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('fr'); });
it('should display the locale', () => {
expect(page.getParagraph('locale')).toEqual('fr');
});
it('the date pipe should show the localized month', () => {
page.navigateTo();
+13 -6
View File
@@ -10,15 +10,15 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/latest-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
@@ -29,11 +29,18 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
}
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
@@ -13,8 +13,8 @@ const contents = fs.readFileSync(filePath, 'utf8');
fs.writeFileSync(filePath + '.bak', contents, 'utf8');
// Write translated file
const updated =
contents.replace(/source>/g, 'target>')
.replace(/Hello/g, 'Bonjour')
.replace(/source-language="([^"]+)"/g, 'source-language="$1" target-language="legacy"');
const updated = contents
.replace(/source>/g, 'target>')
.replace(/Hello/g, 'Bonjour')
.replace(/source-language="([^"]+)"/g, 'source-language="$1" target-language="legacy"');
fs.writeFileSync(filePath, updated, 'utf8');
@@ -11,9 +11,10 @@ const contents = fs.readFileSync(filePath, 'utf8');
// Write translated file
const updatedFilePath = filePath.replace(/\.xmb$/, '.xtb');
const updatedContents = contents.replace(/messagebundle/g, 'translationbundle>')
.replace(/<translationbundle>/g, '<translationbundle lang="legacy">')
.replace(/\bmsg\b/g, 'translation')
.replace(/Hello/g, 'Bonjour')
.replace(/<source>.*<\/source>/g, '');
const updatedContents = contents
.replace(/messagebundle/g, 'translationbundle>')
.replace(/<translationbundle>/g, '<translationbundle lang="legacy">')
.replace(/\bmsg\b/g, 'translation')
.replace(/Hello/g, 'Bonjour')
.replace(/<source>.*<\/source>/g, '');
fs.writeFileSync(updatedFilePath, updatedContents, 'utf8');
@@ -24,7 +24,6 @@ describe('AppComponent', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent)
.toContain('Hello cli-hello-world-ivy-compat!');
expect(compiled.querySelector('h1').textContent).toContain('Hello cli-hello-world-ivy-compat!');
});
});
@@ -1,7 +1,10 @@
import {Component, Inject, LOCALE_ID} from '@angular/core';
@Component(
{selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css']})
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
constructor(@Inject(LOCALE_ID) public locale: string) {}
title = `cli-hello-world-ivy-compat`;
+1 -2
View File
@@ -9,5 +9,4 @@ import {AppComponent} from './app.component';
registerLocaleData(localeFr);
@NgModule({declarations: [AppComponent], imports: [BrowserModule], bootstrap: [AppComponent]})
export class AppModule {
}
export class AppModule {}
+5 -4
View File
@@ -1,6 +1,7 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import {AppModule} from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
@@ -69,7 +69,7 @@ import {loadTranslations} from '@angular/localize';
// Load some runtime translations!
loadTranslations({
[computeMsgId(' Hello {$INTERPOLATION}! ')]: 'Bonjour {$INTERPOLATION}!',
[computeMsgId('Welcome to the i18n app.')]: 'Bienvenue sur l\'application i18n.',
[computeMsgId('Welcome to the i18n app.')]: "Bienvenue sur l'application i18n.",
});
// Set up the locale for the runtime inlining (EXPERIMENTAL)
-1
View File
@@ -59,7 +59,6 @@ import 'zone.js'; // Included with Angular CLI.
*/
import '@angular/localize/init';
/***************************************************************************************************
* APPLICATION IMPORTS
*/
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import {Component} from '@angular/core';
@Component({
selector: 'app-root',
@@ -25,7 +25,7 @@ import { Component } from '@angular/core';
</ul>
`,
styles: []
styles: [],
})
export class AppComponent {
title = $localize`ng-add-localize`;
@@ -1,16 +1,12 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {AppComponent} from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
declarations: [AppComponent],
imports: [BrowserModule],
providers: [],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
+5 -4
View File
@@ -1,6 +1,7 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import {AppModule} from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
+4 -1
View File
@@ -51,7 +51,10 @@ describe('Element E2E Tests', function () {
input.sendKeys('Foo');
// Make tests less flaky on CI by waiting up to 5s for the element text to be updated.
browser.wait(async () => await getShadowDomText(helloWorldShadowEl) === 'Hello Foo!', 5000);
browser.wait(
async () => (await getShadowDomText(helloWorldShadowEl)) === 'Hello Foo!',
5000,
);
});
});
});

Some files were not shown because too many files have changed in this diff Show More