Skip to content

Commit

Permalink
feat: add support for Angular 15
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt committed Nov 20, 2022
1 parent 0da56b4 commit 99ef350
Show file tree
Hide file tree
Showing 42 changed files with 7,775 additions and 11 deletions.
16 changes: 16 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,18 @@ jobs:
paths:
- app/integrations/hello-world-ng14-ivy/dist-integration

integration_ng15_tests:
<<: *job_defaults
steps:
- *attach_workspace
- run:
name: Run integration tests for ng15 application
command: yarn integration:ng15
- persist_to_workspace:
root: ~/workspace
paths:
- app/integrations/hello-world-ng15/dist-integration

integration_test_types:
<<: *job_defaults
steps:
Expand Down Expand Up @@ -366,6 +378,10 @@ workflows:
requires:
- build

- integration_ng15_tests:
requires:
- build

- integration_test_types:
requires:
- build
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
- 'integration:ng12:ivy'
- 'integration:ng13:ivy'
- 'integration:ng14:ivy'
- 'integration:ng15'
- 'test:types'

steps:
Expand Down Expand Up @@ -143,4 +144,4 @@ jobs:
run: yarn bundlemon
env:
BUNDLEMON_PROJECT_ID: 62b174ff6619780d8caf79fa
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
42 changes: 42 additions & 0 deletions integrations/hello-world-ng15/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
96 changes: 96 additions & 0 deletions integrations/hello-world-ng15/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"hello-world-ng15": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist-integration",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "hello-world-ng15:build:production"
},
"development": {
"browserTarget": "hello-world-ng15:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "hello-world-ng15:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": []
}
}
}
}
}
}
7 changes: 7 additions & 0 deletions integrations/hello-world-ng15/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"baseUrl": "http://localhost:4200",
"video": false,
"responseTimeout": 60000,
"pageLoadTimeout": 120000,
"ignoreTestFiles": ["**/plugins/**.js", "**/tsconfig.json"]
}
5 changes: 5 additions & 0 deletions integrations/hello-world-ng15/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// <reference types="cypress" />

import { IndexPo } from '../support/index.po';

describe('Index page', () => {
const index = new IndexPo();

beforeEach(() => index.navigateTo());

it('should render application using the latest version', () => {
// Arrange & act & assert
// Expect that the running applicaiton was compiled
// with the necessary Angular version!
cy.get('app-root')
.invoke('attr', 'ng-version')
.should('have.string', '15');
});

it('should click on the button and increase the counter', () => {
// Arrange & act & assert
cy.get('button')
.click()
.click()
.click()
.get('p')
.should('contain.text', 'Counter is 3');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
resolve: {
extensions: ['.js', '.ts']
},
module: {
rules: [
{
test: /\.ts$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true
}
}
]
}
]
}
};
8 changes: 8 additions & 0 deletions integrations/hello-world-ng15/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const webpack = require('@cypress/webpack-preprocessor');

const webpackOptions = require('./cypress-webpack.config');

module.exports = on => {
const options = { webpackOptions };
on('file:preprocessor', webpack(options));
};
7 changes: 7 additions & 0 deletions integrations/hello-world-ng15/cypress/support/base.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export abstract class BasePo {
abstract pageUrl: string;

navigateTo() {
cy.visit(this.pageUrl);
}
}
5 changes: 5 additions & 0 deletions integrations/hello-world-ng15/cypress/support/index.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { BasePo } from './base.po';

export class IndexPo extends BasePo {
pageUrl = '/';
}
10 changes: 10 additions & 0 deletions integrations/hello-world-ng15/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"typeRoots": ["../node_modules/@types"],
"lib": ["es2017", "dom"]
},
"include": ["integration/*.ts", "support/*.ts", "../node_modules/cypress"]
}
47 changes: 47 additions & 0 deletions integrations/hello-world-ng15/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = 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/ng15'),
subdir: '.',
reporters: [{ type: 'html' }, { type: 'text-summary' }]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
restartOnFileChange: true
});
};
63 changes: 63 additions & 0 deletions integrations/hello-world-ng15/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "hello-world-ng15",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start-test": "start-server-and-test",
"start": "ng serve",
"build": "ng build",
"build:prod": "ng build --configuration production",
"test": "ng test",
"test:ci": "ng test --no-watch --no-progress --browsers=ChromeHeadlessCI --source-map=false",
"test:integration": "yarn install:ivy && yarn test:ci && yarn build:prod && yarn e2e:ci",
"preinstall": "yarn --cwd ../../ cpx -v -C \"@ngxs/**/*\" integrations/hello-world-ng15/node_modules/@ngxs",
"install:ivy": "yarn --frozen-lockfile --non-interactive --no-progress",
"postinstall": "ngcc",
"cy:open": "cypress open",
"cy:run": "cypress run",
"cy:run:ssr": "cypress run --config integrationFolder=cypress/integration-ssr",
"serve:integration:static": "angular-http-server --path dist-integration -p 4200 --silent",
"e2e": "start-test serve:integration:static 4200 cy:open",
"e2e:ci": "start-test serve:integration:static 4200 cy:run"
},
"private": true,
"dependencies": {
"@angular/animations": "15.0.0",
"@angular/common": "15.0.0",
"@angular/compiler": "15.0.0",
"@angular/core": "15.0.0",
"@angular/forms": "15.0.0",
"@angular/platform-browser": "15.0.0",
"@angular/platform-browser-dynamic": "15.0.0",
"@angular/platform-server": "15.0.0",
"@angular/router": "15.0.0",
"@ngxs/devtools-plugin": "file:./node_modules/@ngxs/devtools-plugin",
"@ngxs/form-plugin": "file:./node_modules/@ngxs/form-plugin",
"@ngxs/logger-plugin": "file:./node_modules/@ngxs/logger-plugin",
"@ngxs/router-plugin": "file:./node_modules/@ngxs/router-plugin",
"@ngxs/storage-plugin": "file:./node_modules/@ngxs/storage-plugin",
"@ngxs/store": "file:./node_modules/@ngxs/store",
"@ngxs/websocket-plugin": "file:./node_modules/@ngxs/websocket-plugin",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "15.0.0",
"@angular/cli": "15.0.0",
"@angular/compiler-cli": "15.0.0",
"@types/jasmine": "~4.3.0",
"@types/node": "16.11.38",
"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",
"@cypress/webpack-preprocessor": "file:../../node_modules/@cypress/webpack-preprocessor",
"angular-http-server": "file:../../node_modules/angular-http-server",
"cypress": "file:../../node_modules/cypress",
"start-server-and-test": "file:../../node_modules/start-server-and-test",
"typescript": "~4.8.2"
}
}
4 changes: 4 additions & 0 deletions integrations/hello-world-ng15/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<h1>Angular 15 Integration Test</h1>

<button (click)="increment()">Increment</button>
<p>Counter is {{ counter$ | async }}</p>
Loading

0 comments on commit 99ef350

Please sign in to comment.