test: update cli-hello-world-ivy to cli@7.2.0-rc.0 (#27797)

Updates the app itself to reflect the result of using the  `experimentalIvy` flag on the CLI.
The result is similar to:

    npx @angular/cli@next new cli-hello-world-ivy --experimental-ivy --defaults

But replaces the current (cli `7.2.0-rc.0`) `renderComponent` bootstrap with the usual `platformBrowserDynamic` one.
It also keeps what the app did (display a pipe, tests it).

PR Close #27797
This commit is contained in:
cexbrayat 2018-12-14 15:46:01 +02:00 committed by Ben Lesh
parent c34eee4e8e
commit 62e45cef2d
23 changed files with 2419 additions and 2631 deletions

View File

@ -1,4 +1,4 @@
# Editor configuration, see http://editorconfig.org
# Editor configuration, see https://editorconfig.org
root = true
[*]

View File

@ -1,6 +1,6 @@
# CliHelloWorld
# CliHelloWorldIvy
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.6.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.0-rc.0.
## Development server
@ -12,7 +12,7 @@ Run `ng generate component component-name` to generate a new component. You can
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests

View File

@ -1,14 +1,17 @@
{
"$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "yarn"
},
"newProjectRoot": "projects",
"projects": {
"cli-hello-world": {
"cli-hello-world-ivy": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
@ -19,47 +22,36 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
{
"glob": "assets",
"input": "/src",
"output": "/"
},
{
"glob": "favicon.ico",
"input": "/src",
"output": "/"
}
"src/favicon.ico",
"src/assets"
],
"styles": [
{
"input": "src/styles.css"
}
"src/styles.css"
],
"scripts": []
},
"configurations": {
"dev": {
"production": {
"fileReplacements": [
{
"from": "src/environments/environment.ts",
"to": "dist/environments/environment.ts"
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
},
"production": {
],
"optimization": true,
"outputHashing": "all",
"sourceMap": true,
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
"budgets": [
{
"src": "src/environments/environment.ts",
"replaceWith": "src/environments/environment.prod.ts"
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
@ -68,20 +60,17 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "cli-hello-world:build"
"browserTarget": "cli-hello-world-ivy:build"
},
"configurations": {
"dev": {
"browserTarget": "cli-hello-world:build:dev"
},
"production": {
"browserTarget": "cli-hello-world:build:production"
"browserTarget": "cli-hello-world-ivy:build:production"
},
"ci": {
"progress": false
},
"ci-production": {
"browserTarget": "cli-hello-world:build:production",
"browserTarget": "cli-hello-world-ivy:build:production",
"progress": false
}
}
@ -89,7 +78,7 @@
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "cli-hello-world:build"
"browserTarget": "cli-hello-world-ivy:build"
}
},
"test": {
@ -97,25 +86,15 @@
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"karmaConfig": "./karma.conf.js",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"karmaConfig": "src/karma.conf.js",
"styles": [
{
"input": "src/styles.css"
}
"src/styles.css"
],
"scripts": [],
"assets": [
{
"glob": "assets",
"input": "/src",
"output": "/"
},
{
"glob": "favicon.ico",
"input": "/src",
"output": "/"
}
"src/favicon.ico",
"src/assets"
]
}
},
@ -133,36 +112,33 @@
}
}
},
"cli-hello-world-e2e": {
"root": "",
"cli-hello-world-ivy-e2e": {
"root": "e2e/",
"projectType": "application",
"cli": {},
"schematics": {},
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "cli-hello-world:serve"
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "cli-hello-world-ivy:serve"
},
"configurations": {
"production": {
"devServerTarget": "cli-hello-world:serve:production"
"devServerTarget": "cli-hello-world-ivy:serve:production"
},
"ci": {
"devServerTarget": "cli-hello-world:serve:ci"
"devServerTarget": "cli-hello-world-ivy:serve:ci"
},
"ci-production": {
"devServerTarget": "cli-hello-world:serve:ci-production"
"devServerTarget": "cli-hello-world-ivy:serve:ci-production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
@ -171,13 +147,5 @@
}
}
},
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
"defaultProject": "cli-hello-world-ivy"
}

View File

@ -6,7 +6,7 @@ const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome',
@ -25,7 +25,7 @@ exports.config = {
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}

View File

@ -9,7 +9,7 @@ describe('cli-hello-world App', () => {
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to app!');
expect(page.getParagraphText()).toEqual('Welcome to cli-hello-world-ivy!');
});
it('the percent pipe should work', () => {

View File

@ -1,8 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"baseUrl": "./",
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [

View File

@ -1,5 +1,5 @@
{
"name": "cli-hello-world",
"name": "cli-hello-world-ivy",
"version": "0.0.0",
"license": "MIT",
"scripts": {
@ -29,24 +29,24 @@
"zone.js": "file:../../node_modules/zone.js"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.10.3",
"@angular/cli": "7.0.3",
"@angular-devkit/build-angular": "~0.12.0-rc.0",
"@angular/cli": "~7.2.0-rc.0",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/language-service": "file:../../dist/packages-dist/language-service",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.4",
"@types/node": "~6.0.60",
"codelyzer": "^4.3.0",
"jasmine-core": "~2.8.0",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "file:../../node_modules/protractor",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "file:../../node_modules/typescript"
}
}

View File

@ -12,7 +12,7 @@
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2>
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>

View File

@ -1,5 +1,6 @@
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
@ -8,20 +9,23 @@ describe('AppComponent', () => {
],
}).compileComponents();
}));
it('should create the app', async(() => {
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app'`, async(() => {
});
it(`should have as title 'cli-hello-world-ivy'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
}));
it('should render title in a h1 tag', async(() => {
expect(app.title).toEqual('cli-hello-world-ivy');
});
it('should render title in a h1 tag', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
}));
expect(compiled.querySelector('h1').textContent).toContain('Welcome to cli-hello-world-ivy!');
});
});

View File

@ -6,5 +6,5 @@ import { Component } from '@angular/core';
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
title = 'cli-hello-world-ivy';
}

View File

@ -0,0 +1,11 @@
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
#
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11

View File

@ -1,8 +1,16 @@
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.

View File

@ -2,12 +2,11 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>CliHelloWorld</title>
<title>CliHelloWorldIvy</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script>window['ngDevMode'] = true;</script>
</head>
<body>
<app-root></app-root>

View File

@ -16,12 +16,10 @@ module.exports = function (config) {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
dir: require('path').join(__dirname, 'coverage'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,

View File

@ -9,4 +9,4 @@ if (environment.production) {
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
.catch(err => console.error(err));

View File

@ -11,14 +11,17 @@
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
/** IE9, IE10, IE11, and Chrome <55 requires all of the following polyfills.
* This also includes Android Emulators with older versions of Chrome and Google Search/Googlebot
*/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
@ -40,19 +43,36 @@
/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';
/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';
/**
* Required to support Web Animations `@angular/platform-browser/animations`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags.ts';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
@ -60,7 +80,6 @@ import 'core-js/es7/reflect';
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/

View File

@ -2,12 +2,13 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
],
"angularCompilerOptions": {
"enableIvy": "ngtsc"
}
}

View File

@ -2,8 +2,6 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"types": [
"jasmine",
"node"

View File

@ -0,0 +1,17 @@
{
"extends": "../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
]
}
}

View File

@ -1,21 +1,21 @@
{
"angularCompilerOptions": {
"enableIvy": "ngtsc",
},
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"es2018",
"dom"
]
}

View File

@ -1,6 +1,6 @@
{
"rulesDirectory": [
"node_modules/codelyzer"
"codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
@ -18,7 +18,6 @@
"forin": true,
"import-blacklist": [
true,
"rxjs",
"rxjs/Rx"
],
"import-spacing": true,
@ -66,6 +65,7 @@
],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
@ -117,18 +117,6 @@
"check-separator",
"check-type"
],
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"no-output-on-prefix": true,
"use-input-property-decorator": true,
"use-output-property-decorator": true,

File diff suppressed because it is too large Load Diff