From 235eb43646341e29d9a3a116e4d6732dd3fe04e7 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 29 Nov 2023 11:20:13 +0000 Subject: [PATCH] test: update base project for E2E tests to version 15 Update the base update E2E test project to the minimum supported Angular version. (cherry picked from commit 442d7bc239c1f5a6fcf2f5227b5525ebc0517957) --- .../e2e/assets/14.0-project/.browserslistrc | 16 ------ .../e2e/assets/14.0-project/karma.conf.js | 44 --------------- .../e2e/assets/14.0-project/package.json | 38 ------------- .../src/environments/environment.prod.ts | 3 - .../src/environments/environment.ts | 16 ------ .../e2e/assets/14.0-project/src/polyfills.ts | 53 ------------------ .../e2e/assets/14.0-project/src/test.ts | 26 --------- .../.editorconfig | 0 .../{14.0-project => 15.0-project}/.gitignore | 0 .../{14.0-project => 15.0-project}/README.md | 4 +- .../angular.json | 27 ++++----- .../e2e/assets/15.0-project/package.json | 38 +++++++++++++ .../src/app/app-routing.module.ts | 0 .../src/app/app.component.css | 0 .../src/app/app.component.html | 2 +- .../src/app/app.component.spec.ts | 6 +- .../src/app/app.component.ts | 2 +- .../src/app/app.module.ts | 0 .../src/assets/.gitkeep | 0 .../src/favicon.ico | Bin .../src/index.html | 2 +- .../src/main.ts | 5 -- .../src/styles.css | 0 .../tsconfig.app.json | 3 +- .../tsconfig.json | 7 ++- .../tsconfig.spec.json | 4 -- .../tests/update/update-multiple-versions.ts | 2 +- tests/legacy-cli/e2e/tests/update/update.ts | 14 ++--- 28 files changed, 71 insertions(+), 241 deletions(-) delete mode 100644 tests/legacy-cli/e2e/assets/14.0-project/.browserslistrc delete mode 100644 tests/legacy-cli/e2e/assets/14.0-project/karma.conf.js delete mode 100644 tests/legacy-cli/e2e/assets/14.0-project/package.json delete mode 100644 tests/legacy-cli/e2e/assets/14.0-project/src/environments/environment.prod.ts delete mode 100644 tests/legacy-cli/e2e/assets/14.0-project/src/environments/environment.ts delete mode 100644 tests/legacy-cli/e2e/assets/14.0-project/src/polyfills.ts delete mode 100644 tests/legacy-cli/e2e/assets/14.0-project/src/test.ts rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/.editorconfig (100%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/.gitignore (100%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/README.md (94%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/angular.json (78%) create mode 100644 tests/legacy-cli/e2e/assets/15.0-project/package.json rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/app/app-routing.module.ts (100%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/app/app.component.css (100%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/app/app.component.html (99%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/app/app.component.spec.ts (85%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/app/app.component.ts (86%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/app/app.module.ts (100%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/assets/.gitkeep (100%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/favicon.ico (100%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/index.html (89%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/main.ts (57%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/src/styles.css (100%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/tsconfig.app.json (85%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/tsconfig.json (88%) rename tests/legacy-cli/e2e/assets/{14.0-project => 15.0-project}/tsconfig.spec.json (81%) diff --git a/tests/legacy-cli/e2e/assets/14.0-project/.browserslistrc b/tests/legacy-cli/e2e/assets/14.0-project/.browserslistrc deleted file mode 100644 index 4f9ac26980c1..000000000000 --- a/tests/legacy-cli/e2e/assets/14.0-project/.browserslistrc +++ /dev/null @@ -1,16 +0,0 @@ -# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. -# For additional information regarding the format and rule options, please see: -# https://github.com/browserslist/browserslist#queries - -# For the full list of supported browsers by the Angular framework, please see: -# https://angular.io/guide/browser-support - -# You can see what browsers were selected by your queries by running: -# npx browserslist - -last 1 Chrome version -last 1 Firefox version -last 2 Edge major versions -last 2 Safari major versions -last 2 iOS major versions -Firefox ESR diff --git a/tests/legacy-cli/e2e/assets/14.0-project/karma.conf.js b/tests/legacy-cli/e2e/assets/14.0-project/karma.conf.js deleted file mode 100644 index d1c7d0a02ea0..000000000000 --- a/tests/legacy-cli/e2e/assets/14.0-project/karma.conf.js +++ /dev/null @@ -1,44 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - jasmine: { - // you can add configuration options for Jasmine here - // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html - // for example, you can disable the random execution with `random: false` - // or set a specific seed with `seed: 4321` - }, - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - jasmineHtmlReporter: { - suppressAll: true // removes the duplicated traces - }, - coverageReporter: { - dir: require('path').join(__dirname, './coverage/fourteen-project'), - subdir: '.', - reporters: [ - { type: 'html' }, - { type: 'text-summary' } - ] - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/tests/legacy-cli/e2e/assets/14.0-project/package.json b/tests/legacy-cli/e2e/assets/14.0-project/package.json deleted file mode 100644 index 97c55c8bb9aa..000000000000 --- a/tests/legacy-cli/e2e/assets/14.0-project/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "fourteen-project", - "version": "0.0.0", - "scripts": { - "ng": "ng", - "start": "ng serve", - "build": "ng build", - "watch": "ng build --watch --configuration development", - "test": "ng test" - }, - "private": true, - "dependencies": { - "@angular/animations": "^14.2.0", - "@angular/common": "^14.2.0", - "@angular/compiler": "^14.2.0", - "@angular/core": "^14.2.0", - "@angular/forms": "^14.2.0", - "@angular/platform-browser": "^14.2.0", - "@angular/platform-browser-dynamic": "^14.2.0", - "@angular/router": "^14.2.0", - "rxjs": "~7.5.0", - "tslib": "^2.3.0", - "zone.js": "~0.11.4" - }, - "devDependencies": { - "@angular-devkit/build-angular": "^14.2.5", - "@angular/cli": "~14.2.5", - "@angular/compiler-cli": "^14.2.0", - "@types/jasmine": "~4.0.0", - "jasmine-core": "~4.3.0", - "karma": "~6.4.0", - "karma-chrome-launcher": "~3.1.0", - "karma-coverage": "~2.2.0", - "karma-jasmine": "~5.1.0", - "karma-jasmine-html-reporter": "~2.0.0", - "typescript": "~4.7.2" - } -} diff --git a/tests/legacy-cli/e2e/assets/14.0-project/src/environments/environment.prod.ts b/tests/legacy-cli/e2e/assets/14.0-project/src/environments/environment.prod.ts deleted file mode 100644 index 3612073bc31c..000000000000 --- a/tests/legacy-cli/e2e/assets/14.0-project/src/environments/environment.prod.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const environment = { - production: true -}; diff --git a/tests/legacy-cli/e2e/assets/14.0-project/src/environments/environment.ts b/tests/legacy-cli/e2e/assets/14.0-project/src/environments/environment.ts deleted file mode 100644 index f56ff47022c7..000000000000 --- a/tests/legacy-cli/e2e/assets/14.0-project/src/environments/environment.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file can be replaced during build by using the `fileReplacements` array. -// `ng build` 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/plugins/zone-error'; // Included with Angular CLI. diff --git a/tests/legacy-cli/e2e/assets/14.0-project/src/polyfills.ts b/tests/legacy-cli/e2e/assets/14.0-project/src/polyfills.ts deleted file mode 100644 index 429bb9ef2d34..000000000000 --- a/tests/legacy-cli/e2e/assets/14.0-project/src/polyfills.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This file includes polyfills needed by Angular and is loaded before the app. - * You can add your own extra polyfills to this file. - * - * This file is divided into 2 sections: - * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. - * 2. Application imports. Files imported after ZoneJS that should be loaded before your main - * file. - * - * The current setup is for so-called "evergreen" browsers; the last versions of browsers that - * automatically update themselves. This includes recent versions of Safari, Chrome (including - * Opera), Edge on the desktop, and iOS and Chrome on mobile. - * - * Learn more in https://angular.io/guide/browser-support - */ - -/*************************************************************************************************** - * BROWSER POLYFILLS - */ - -/** - * 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'; - * - * 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__UNPATCHED_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. - */ -import 'zone.js'; // Included with Angular CLI. - - -/*************************************************************************************************** - * APPLICATION IMPORTS - */ diff --git a/tests/legacy-cli/e2e/assets/14.0-project/src/test.ts b/tests/legacy-cli/e2e/assets/14.0-project/src/test.ts deleted file mode 100644 index c04c876075f9..000000000000 --- a/tests/legacy-cli/e2e/assets/14.0-project/src/test.ts +++ /dev/null @@ -1,26 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: { - context(path: string, deep?: boolean, filter?: RegExp): { - (id: string): T; - keys(): string[]; - }; -}; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting(), -); - -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().forEach(context); diff --git a/tests/legacy-cli/e2e/assets/14.0-project/.editorconfig b/tests/legacy-cli/e2e/assets/15.0-project/.editorconfig similarity index 100% rename from tests/legacy-cli/e2e/assets/14.0-project/.editorconfig rename to tests/legacy-cli/e2e/assets/15.0-project/.editorconfig diff --git a/tests/legacy-cli/e2e/assets/14.0-project/.gitignore b/tests/legacy-cli/e2e/assets/15.0-project/.gitignore similarity index 100% rename from tests/legacy-cli/e2e/assets/14.0-project/.gitignore rename to tests/legacy-cli/e2e/assets/15.0-project/.gitignore diff --git a/tests/legacy-cli/e2e/assets/14.0-project/README.md b/tests/legacy-cli/e2e/assets/15.0-project/README.md similarity index 94% rename from tests/legacy-cli/e2e/assets/14.0-project/README.md rename to tests/legacy-cli/e2e/assets/15.0-project/README.md index dde9b9839bd8..0a68ccaedd59 100644 --- a/tests/legacy-cli/e2e/assets/14.0-project/README.md +++ b/tests/legacy-cli/e2e/assets/15.0-project/README.md @@ -1,6 +1,6 @@ -# FourteenProject +# FifteenProject -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.5. +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.8. ## Development server diff --git a/tests/legacy-cli/e2e/assets/14.0-project/angular.json b/tests/legacy-cli/e2e/assets/15.0-project/angular.json similarity index 78% rename from tests/legacy-cli/e2e/assets/14.0-project/angular.json rename to tests/legacy-cli/e2e/assets/15.0-project/angular.json index dc6055ea0dd5..23915a2857d0 100644 --- a/tests/legacy-cli/e2e/assets/14.0-project/angular.json +++ b/tests/legacy-cli/e2e/assets/15.0-project/angular.json @@ -3,7 +3,7 @@ "version": 1, "newProjectRoot": "projects", "projects": { - "fourteen-project": { + "fifteen-project": { "projectType": "application", "schematics": {}, "root": "", @@ -13,10 +13,12 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist/fourteen-project", + "outputPath": "dist/fifteen-project", "index": "src/index.html", "main": "src/main.ts", - "polyfills": "src/polyfills.ts", + "polyfills": [ + "zone.js" + ], "tsConfig": "tsconfig.app.json", "assets": [ "src/favicon.ico", @@ -41,12 +43,6 @@ "maximumError": "4kb" } ], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" - } - ], "outputHashing": "all" }, "development": { @@ -64,10 +60,10 @@ "builder": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "fourteen-project:build:production" + "browserTarget": "fifteen-project:build:production" }, "development": { - "browserTarget": "fourteen-project:build:development" + "browserTarget": "fifteen-project:build:development" } }, "defaultConfiguration": "development" @@ -75,16 +71,17 @@ "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "fourteen-project:build" + "browserTarget": "fifteen-project:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "src/test.ts", - "polyfills": "src/polyfills.ts", + "polyfills": [ + "zone.js", + "zone.js/testing" + ], "tsConfig": "tsconfig.spec.json", - "karmaConfig": "karma.conf.js", "assets": [ "src/favicon.ico", "src/assets" diff --git a/tests/legacy-cli/e2e/assets/15.0-project/package.json b/tests/legacy-cli/e2e/assets/15.0-project/package.json new file mode 100644 index 000000000000..090495cc053e --- /dev/null +++ b/tests/legacy-cli/e2e/assets/15.0-project/package.json @@ -0,0 +1,38 @@ +{ + "name": "fifteen-project", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "watch": "ng build --watch --configuration development", + "test": "ng test" + }, + "private": true, + "dependencies": { + "@angular/animations": "^15.2.0", + "@angular/common": "^15.2.0", + "@angular/compiler": "^15.2.0", + "@angular/core": "^15.2.0", + "@angular/forms": "^15.2.0", + "@angular/platform-browser": "^15.2.0", + "@angular/platform-browser-dynamic": "^15.2.0", + "@angular/router": "^15.2.0", + "rxjs": "~7.8.0", + "tslib": "^2.3.0", + "zone.js": "~0.12.0" + }, + "devDependencies": { + "@angular-devkit/build-angular": "^15.2.8", + "@angular/cli": "~15.2.8", + "@angular/compiler-cli": "^15.2.0", + "@types/jasmine": "~4.3.0", + "jasmine-core": "~4.5.0", + "karma": "~6.4.0", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage": "~2.2.0", + "karma-jasmine": "~5.1.0", + "karma-jasmine-html-reporter": "~2.0.0", + "typescript": "~4.9.4" + } +} diff --git a/tests/legacy-cli/e2e/assets/14.0-project/src/app/app-routing.module.ts b/tests/legacy-cli/e2e/assets/15.0-project/src/app/app-routing.module.ts similarity index 100% rename from tests/legacy-cli/e2e/assets/14.0-project/src/app/app-routing.module.ts rename to tests/legacy-cli/e2e/assets/15.0-project/src/app/app-routing.module.ts diff --git a/tests/legacy-cli/e2e/assets/14.0-project/src/app/app.component.css b/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.css similarity index 100% rename from tests/legacy-cli/e2e/assets/14.0-project/src/app/app.component.css rename to tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.css diff --git a/tests/legacy-cli/e2e/assets/14.0-project/src/app/app.component.html b/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html similarity index 99% rename from tests/legacy-cli/e2e/assets/14.0-project/src/app/app.component.html rename to tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html index d6e32db31e92..2a0fbf18f851 100644 --- a/tests/legacy-cli/e2e/assets/14.0-project/src/app/app.component.html +++ b/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.html @@ -305,7 +305,7 @@